Handling ORA-01403: no data found The Next CEO of Stack OverflowCan not have CREATE TABLE inside if elseError in plsql . here flag has value 1 or no data. when no data i have to insert somethings but error coming.suggestions pleaseOracle procedure exception compile errorOracle Stored Procedure Compilation error during alter tableWhy am I encountering the symbol end of file in Oracle?EXCEPTION in before the end of the loopRegarding PLSQLhow to do exception handling separately for more than one FORALL statementWhen No data found Oraclesql error generated

A hang glider, sudden unexpected lift to 25,000 feet altitude, what could do this?

What happens if you break a law in another country outside of that country?

Free fall ellipse or parabola?

Creating a script with console commands

Car headlights in a world without electricity

Why does freezing point matter when picking cooler ice packs?

Shortening a title without changing its meaning

How to coordinate airplane tickets?

Small nick on power cord from an electric alarm clock, and copper wiring exposed but intact

Planeswalker Ability and Death Timing

Direct Implications Between USA and UK in Event of No-Deal Brexit

pgfplots: How to draw a tangent graph below two others?

logical reads on global temp table, but not on session-level temp table

Is there a rule of thumb for determining the amount one should accept for a settlement offer?

What did the word "leisure" mean in late 18th Century usage?

Man transported from Alternate World into ours by a Neutrino Detector

Read/write a pipe-delimited file line by line with some simple text manipulation

Incomplete cube

Does the Idaho Potato Commission associate potato skins with healthy eating?

Create custom note boxes

How to compactly explain secondary and tertiary characters without resorting to stereotypes?

Does int main() need a declaration on C++?

Can this transistor (2N2222) take 6 V on emitter-base? Am I reading the datasheet incorrectly?

What is the difference between 'contrib' and 'non-free' packages repositories?



Handling ORA-01403: no data found



The Next CEO of Stack OverflowCan not have CREATE TABLE inside if elseError in plsql . here flag has value 1 or no data. when no data i have to insert somethings but error coming.suggestions pleaseOracle procedure exception compile errorOracle Stored Procedure Compilation error during alter tableWhy am I encountering the symbol end of file in Oracle?EXCEPTION in before the end of the loopRegarding PLSQLhow to do exception handling separately for more than one FORALL statementWhen No data found Oraclesql error generated










1















I want to handle no data found. Whenever this exception is raised I want the program to continue, without stopping on error. Below is code snippet



BEGIN
OPEN C_TABLE_PARTITON_LIST;
LOOP
FETCH C_TABLE_PARTITON_LIST INTO TABLE_PARTITION_LIST;
EXIT WHEN C_TABLE_PARTITON_LIST%NOTFOUND;
SELECT COLUMN_NAME INTO PARTITION_COLUMN_NAME from ALL_PART_KEY_COLUMNS
sqlstring :='SELECT ( '|| PARTITION_COLUMN_NAME ||'from test';
EXECUTE IMMEDIATE sqlstring INTO F_RESULT;
exception when no_data_found then
dbms_output.put_line('no data found.');
DBMS_OUTPUT.put_line( F_RESULT);

END LOOP;
CLOSE C_TABLE_PARTITON_LIST;
END;


When I add Exception, my code is breaking with below error




PLS-00103: Encountered the symbol "EXCEPTION" when expecting one of the following:

( begin case declare end exit for goto if loop mod null
pragma raise return select update while with
<<
continue close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge pipe purge
json_exists json_value json_query json_object json_array

ORA-06550: line 29, column 3:

PLS-00103: Encountered the symbol "CLOSE" when expecting one of the following:

end not pragma final instantiable order overriding static
member constructor map











share|improve this question




























    1















    I want to handle no data found. Whenever this exception is raised I want the program to continue, without stopping on error. Below is code snippet



    BEGIN
    OPEN C_TABLE_PARTITON_LIST;
    LOOP
    FETCH C_TABLE_PARTITON_LIST INTO TABLE_PARTITION_LIST;
    EXIT WHEN C_TABLE_PARTITON_LIST%NOTFOUND;
    SELECT COLUMN_NAME INTO PARTITION_COLUMN_NAME from ALL_PART_KEY_COLUMNS
    sqlstring :='SELECT ( '|| PARTITION_COLUMN_NAME ||'from test';
    EXECUTE IMMEDIATE sqlstring INTO F_RESULT;
    exception when no_data_found then
    dbms_output.put_line('no data found.');
    DBMS_OUTPUT.put_line( F_RESULT);

    END LOOP;
    CLOSE C_TABLE_PARTITON_LIST;
    END;


    When I add Exception, my code is breaking with below error




    PLS-00103: Encountered the symbol "EXCEPTION" when expecting one of the following:

    ( begin case declare end exit for goto if loop mod null
    pragma raise return select update while with
    <<
    continue close current delete fetch lock insert open rollback
    savepoint set sql execute commit forall merge pipe purge
    json_exists json_value json_query json_object json_array

    ORA-06550: line 29, column 3:

    PLS-00103: Encountered the symbol "CLOSE" when expecting one of the following:

    end not pragma final instantiable order overriding static
    member constructor map











    share|improve this question


























      1












      1








      1








      I want to handle no data found. Whenever this exception is raised I want the program to continue, without stopping on error. Below is code snippet



      BEGIN
      OPEN C_TABLE_PARTITON_LIST;
      LOOP
      FETCH C_TABLE_PARTITON_LIST INTO TABLE_PARTITION_LIST;
      EXIT WHEN C_TABLE_PARTITON_LIST%NOTFOUND;
      SELECT COLUMN_NAME INTO PARTITION_COLUMN_NAME from ALL_PART_KEY_COLUMNS
      sqlstring :='SELECT ( '|| PARTITION_COLUMN_NAME ||'from test';
      EXECUTE IMMEDIATE sqlstring INTO F_RESULT;
      exception when no_data_found then
      dbms_output.put_line('no data found.');
      DBMS_OUTPUT.put_line( F_RESULT);

      END LOOP;
      CLOSE C_TABLE_PARTITON_LIST;
      END;


      When I add Exception, my code is breaking with below error




      PLS-00103: Encountered the symbol "EXCEPTION" when expecting one of the following:

      ( begin case declare end exit for goto if loop mod null
      pragma raise return select update while with
      <<
      continue close current delete fetch lock insert open rollback
      savepoint set sql execute commit forall merge pipe purge
      json_exists json_value json_query json_object json_array

      ORA-06550: line 29, column 3:

      PLS-00103: Encountered the symbol "CLOSE" when expecting one of the following:

      end not pragma final instantiable order overriding static
      member constructor map











      share|improve this question
















      I want to handle no data found. Whenever this exception is raised I want the program to continue, without stopping on error. Below is code snippet



      BEGIN
      OPEN C_TABLE_PARTITON_LIST;
      LOOP
      FETCH C_TABLE_PARTITON_LIST INTO TABLE_PARTITION_LIST;
      EXIT WHEN C_TABLE_PARTITON_LIST%NOTFOUND;
      SELECT COLUMN_NAME INTO PARTITION_COLUMN_NAME from ALL_PART_KEY_COLUMNS
      sqlstring :='SELECT ( '|| PARTITION_COLUMN_NAME ||'from test';
      EXECUTE IMMEDIATE sqlstring INTO F_RESULT;
      exception when no_data_found then
      dbms_output.put_line('no data found.');
      DBMS_OUTPUT.put_line( F_RESULT);

      END LOOP;
      CLOSE C_TABLE_PARTITON_LIST;
      END;


      When I add Exception, my code is breaking with below error




      PLS-00103: Encountered the symbol "EXCEPTION" when expecting one of the following:

      ( begin case declare end exit for goto if loop mod null
      pragma raise return select update while with
      <<
      continue close current delete fetch lock insert open rollback
      savepoint set sql execute commit forall merge pipe purge
      json_exists json_value json_query json_object json_array

      ORA-06550: line 29, column 3:

      PLS-00103: Encountered the symbol "CLOSE" when expecting one of the following:

      end not pragma final instantiable order overriding static
      member constructor map








      oracle plsql






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 7 at 22:44









      William Robertson

      8,50732233




      8,50732233










      asked Mar 7 at 19:44









      upogupog

      3,05342347




      3,05342347






















          1 Answer
          1






          active

          oldest

          votes


















          2














          You have to enclose offending part of the script into its own BEGIN-EXCEPTION-END block, e.g.



          BEGIN
          OPEN C_TABLE_PARTITON_LIST;
          LOOP
          FETCH C_TABLE_PARTITON_LIST INTO TABLE_PARTITION_LIST;
          EXIT WHEN C_TABLE_PARTITON_LIST%NOTFOUND;

          begin --> you need this ...

          SELECT COLUMN_NAME INTO PARTITION_COLUMN_NAME from ALL_PART_KEY_COLUMNS
          sqlstring :='SELECT ( '|| PARTITION_COLUMN_NAME ||'from test';
          EXECUTE IMMEDIATE sqlstring INTO F_RESULT;
          exception when no_data_found then
          dbms_output.put_line('no data found.');
          DBMS_OUTPUT.put_line( F_RESULT);

          end; --> ... and this

          END LOOP;
          CLOSE C_TABLE_PARTITON_LIST;
          END;


          Note that I just showed the way to do that. Code you posted



          • is incomplete (misses the DECLARE section)

          • is invalid (SELECT statement lacks semi-colon, and probably a WHERE clause


          • SQLSTRING variable won't work; 'from test' should have a leading space, otherwise that statement will be invalid

          • I suggest you first DBMS_OUTPUT the SQLSTRING to make sure it is correct; then execute it.





          share|improve this answer

























          • Thanks, Adding Being and End around Exception works.

            – upog
            Mar 8 at 20:26











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55051698%2fhandling-ora-01403-no-data-found%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          You have to enclose offending part of the script into its own BEGIN-EXCEPTION-END block, e.g.



          BEGIN
          OPEN C_TABLE_PARTITON_LIST;
          LOOP
          FETCH C_TABLE_PARTITON_LIST INTO TABLE_PARTITION_LIST;
          EXIT WHEN C_TABLE_PARTITON_LIST%NOTFOUND;

          begin --> you need this ...

          SELECT COLUMN_NAME INTO PARTITION_COLUMN_NAME from ALL_PART_KEY_COLUMNS
          sqlstring :='SELECT ( '|| PARTITION_COLUMN_NAME ||'from test';
          EXECUTE IMMEDIATE sqlstring INTO F_RESULT;
          exception when no_data_found then
          dbms_output.put_line('no data found.');
          DBMS_OUTPUT.put_line( F_RESULT);

          end; --> ... and this

          END LOOP;
          CLOSE C_TABLE_PARTITON_LIST;
          END;


          Note that I just showed the way to do that. Code you posted



          • is incomplete (misses the DECLARE section)

          • is invalid (SELECT statement lacks semi-colon, and probably a WHERE clause


          • SQLSTRING variable won't work; 'from test' should have a leading space, otherwise that statement will be invalid

          • I suggest you first DBMS_OUTPUT the SQLSTRING to make sure it is correct; then execute it.





          share|improve this answer

























          • Thanks, Adding Being and End around Exception works.

            – upog
            Mar 8 at 20:26















          2














          You have to enclose offending part of the script into its own BEGIN-EXCEPTION-END block, e.g.



          BEGIN
          OPEN C_TABLE_PARTITON_LIST;
          LOOP
          FETCH C_TABLE_PARTITON_LIST INTO TABLE_PARTITION_LIST;
          EXIT WHEN C_TABLE_PARTITON_LIST%NOTFOUND;

          begin --> you need this ...

          SELECT COLUMN_NAME INTO PARTITION_COLUMN_NAME from ALL_PART_KEY_COLUMNS
          sqlstring :='SELECT ( '|| PARTITION_COLUMN_NAME ||'from test';
          EXECUTE IMMEDIATE sqlstring INTO F_RESULT;
          exception when no_data_found then
          dbms_output.put_line('no data found.');
          DBMS_OUTPUT.put_line( F_RESULT);

          end; --> ... and this

          END LOOP;
          CLOSE C_TABLE_PARTITON_LIST;
          END;


          Note that I just showed the way to do that. Code you posted



          • is incomplete (misses the DECLARE section)

          • is invalid (SELECT statement lacks semi-colon, and probably a WHERE clause


          • SQLSTRING variable won't work; 'from test' should have a leading space, otherwise that statement will be invalid

          • I suggest you first DBMS_OUTPUT the SQLSTRING to make sure it is correct; then execute it.





          share|improve this answer

























          • Thanks, Adding Being and End around Exception works.

            – upog
            Mar 8 at 20:26













          2












          2








          2







          You have to enclose offending part of the script into its own BEGIN-EXCEPTION-END block, e.g.



          BEGIN
          OPEN C_TABLE_PARTITON_LIST;
          LOOP
          FETCH C_TABLE_PARTITON_LIST INTO TABLE_PARTITION_LIST;
          EXIT WHEN C_TABLE_PARTITON_LIST%NOTFOUND;

          begin --> you need this ...

          SELECT COLUMN_NAME INTO PARTITION_COLUMN_NAME from ALL_PART_KEY_COLUMNS
          sqlstring :='SELECT ( '|| PARTITION_COLUMN_NAME ||'from test';
          EXECUTE IMMEDIATE sqlstring INTO F_RESULT;
          exception when no_data_found then
          dbms_output.put_line('no data found.');
          DBMS_OUTPUT.put_line( F_RESULT);

          end; --> ... and this

          END LOOP;
          CLOSE C_TABLE_PARTITON_LIST;
          END;


          Note that I just showed the way to do that. Code you posted



          • is incomplete (misses the DECLARE section)

          • is invalid (SELECT statement lacks semi-colon, and probably a WHERE clause


          • SQLSTRING variable won't work; 'from test' should have a leading space, otherwise that statement will be invalid

          • I suggest you first DBMS_OUTPUT the SQLSTRING to make sure it is correct; then execute it.





          share|improve this answer















          You have to enclose offending part of the script into its own BEGIN-EXCEPTION-END block, e.g.



          BEGIN
          OPEN C_TABLE_PARTITON_LIST;
          LOOP
          FETCH C_TABLE_PARTITON_LIST INTO TABLE_PARTITION_LIST;
          EXIT WHEN C_TABLE_PARTITON_LIST%NOTFOUND;

          begin --> you need this ...

          SELECT COLUMN_NAME INTO PARTITION_COLUMN_NAME from ALL_PART_KEY_COLUMNS
          sqlstring :='SELECT ( '|| PARTITION_COLUMN_NAME ||'from test';
          EXECUTE IMMEDIATE sqlstring INTO F_RESULT;
          exception when no_data_found then
          dbms_output.put_line('no data found.');
          DBMS_OUTPUT.put_line( F_RESULT);

          end; --> ... and this

          END LOOP;
          CLOSE C_TABLE_PARTITON_LIST;
          END;


          Note that I just showed the way to do that. Code you posted



          • is incomplete (misses the DECLARE section)

          • is invalid (SELECT statement lacks semi-colon, and probably a WHERE clause


          • SQLSTRING variable won't work; 'from test' should have a leading space, otherwise that statement will be invalid

          • I suggest you first DBMS_OUTPUT the SQLSTRING to make sure it is correct; then execute it.






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 7 at 20:26

























          answered Mar 7 at 20:10









          LittlefootLittlefoot

          25.1k71634




          25.1k71634












          • Thanks, Adding Being and End around Exception works.

            – upog
            Mar 8 at 20:26

















          • Thanks, Adding Being and End around Exception works.

            – upog
            Mar 8 at 20:26
















          Thanks, Adding Being and End around Exception works.

          – upog
          Mar 8 at 20:26





          Thanks, Adding Being and End around Exception works.

          – upog
          Mar 8 at 20:26



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55051698%2fhandling-ora-01403-no-data-found%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

          Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

          Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved