Oracle coding error ORA-06550

366225 pts.
Tags:
ORA-06550
Oracle development
Oracle error messages
Hi, I get the following error on compiling my code - *********************************************************** ORA-06550: line 16, column 1: PLS-00103: Encountered the symbol "ELSE" when expecting one of the following: begin case declare end exit for goto if loop mod null pragma raise return select update while with <an identifier> <a double-quoted delimited-identifier> <a bind variable> << close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge <a single-quoted SQL string> pipe ORA-06550: line 19, column 1: PLS-00103: Encountered the symbol "END" 06550. 00000 - "line %s, column %s:n%s" *Cause: Usually a PL/SQL compilation error. *Action: ******************************************************** MyCode is ******************************************************** drop table BDTable; / CREATE GLOBAL TEMPORARY TABLE BDTable ( BDGroupArea VARCHAR(1) ) ON COMMIT DELETE ROWS / declare str VARCHAR(255); BDGroupArea VARCHAR(255); pos integer; Begin BDGroupArea:='1,2,3'; IF (instr(BDGroupArea, '%,%')<>0) Then WHILE (INSTR(BDGroupArea, '%,%')<>0) LOOP BEGIN BDGroupArea := BDGroupArea + ',' ; pos:= instr(BDGroupArea, ','); str:= SUBSTR(BDGroupArea,1,pos-1); INSERT INTO BDTable (BDGroupArea) VALUES (str); BDGroupArea:= SUBSTR(BDGroupArea, pos+1, LENGTH(BDGroupArea)); END LOOP; ELSE INSERT INTO BDTable (BDGroupArea) VALUES ( BDGroupArea ); End IF; End; / SELECT * FROM BDTable; / Thanks, Sowmya

Answer Wiki

Thanks. We'll let you know when a new response is added.

 Here is your right code. “BEGIN” inside the loop didn’t have “END”

DECLARE
str VARCHAR(255);
BDGroupArea VARCHAR(255);
pos INTEGER;
BEGIN
BDGroupArea := ‘1,2,3’;

IF (INSTR(BDGroupArea,’%,%’) <> 0) THEN
WHILE(INSTR(BDGroupArea,’%,%’) <> 0) LOOP
–BEGIN
BDGroupArea := BDGroupArea + ‘,';
pos := INSTR(BDGroupArea,’,’);
str := SUBSTR(BDGroupArea,1, pos – 1);

INSERT INTO BDTable
(BDGroupArea)
VALUES (str);

BDGroupArea := SUBSTR(BDGroupArea, pos + 1 ,LENGTH(BDGroupArea));
END LOOP;
ELSE
INSERT INTO BDTable
(BDGroupArea)
VALUES (BDGroupArea);
END IF;
END;

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • gun003

    getting PLS-00103: Encountered the symbol "" when expecting one of the
             following:
             ( begin case declare exit for goto if loop mod null pragma
             raise return select update while with <an identifier>
             <a double-quoted delimited-identifier> <a bind variable> <<
             continue close current delete fetch lock insert open rollback
             savepoint set sql execute commit forall merge pipe purge




    for this code---

    IF(v_Hybrid_col_id IS NOT NULL) THEN
                                    --{
                BEGIN
                   SELECT SUBSTR(v_Hybrid_col_id,2,length((v_Hybrid_col_id)-1))
            INTO v_Hybrid_col_id_new
            FROM DUAL;
            EXCEPTION
            WHEN NO_DATA_FOUND THEN
            v_Hybrid_col_id_new := ' ';
                 END;
           --}
          END IF;



    need help 

    10 pointsBadges:
    report
  • carlosdl
    Hi gun003,

    Please create a new question, and make sure to post your code using the "code" tool.

    Also, it might be necessary to see the whole code, since the part you posted includes variables whose definition was not included.

    73,415 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following