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
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
add a comment |
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
add a comment |
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
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
oracle plsql
edited Mar 7 at 22:44
William Robertson
8,50732233
8,50732233
asked Mar 7 at 19:44
upogupog
3,05342347
3,05342347
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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 aWHERE
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
theSQLSTRING
to make sure it is correct; then execute it.
Thanks, Adding Being and End around Exception works.
– upog
Mar 8 at 20:26
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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 aWHERE
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
theSQLSTRING
to make sure it is correct; then execute it.
Thanks, Adding Being and End around Exception works.
– upog
Mar 8 at 20:26
add a comment |
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 aWHERE
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
theSQLSTRING
to make sure it is correct; then execute it.
Thanks, Adding Being and End around Exception works.
– upog
Mar 8 at 20:26
add a comment |
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 aWHERE
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
theSQLSTRING
to make sure it is correct; then execute it.
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 aWHERE
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
theSQLSTRING
to make sure it is correct; then execute it.
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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