dbTalk Databases Forums  

SQL-Proceudre: SELECT ... INTO... within a while loop - doesnīt work

comp.databases.oracle comp.databases.oracle


Discuss SQL-Proceudre: SELECT ... INTO... within a while loop - doesnīt work in the comp.databases.oracle forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
bert
 
Posts: n/a

Default SQL-Proceudre: SELECT ... INTO... within a while loop - doesnīt work - 07-16-2004 , 09:15 AM






Hi,

I want to insert the result of a select into a procedure-variable
within a while-loop. The loop works as far as I donīt insert following
line:

select tea.FDATE into ldTeaDate2 from ... tea where tea.ID = ldTeaId;

the error message:
ORA-01403: no data found
ORA-06512: at "...", line 70

The table and variables are created by the same user, who execute the
statement.

Have anyone an idea?

Reply With Quote
  #2  
Old   
Wit Serdakovskij
 
Posts: n/a

Default Re: SQL-Proceudre: SELECT ... INTO... within a while loop - doesnīt work - 07-16-2004 , 09:27 AM






Hello, bert,

near 07:15 16-Jul from bertholomaeus (AT) yahoo (DOT) ca:

Quote:
Hi,

I want to insert the result of a select into a procedure-variable
within a while-loop. The loop works as far as I donīt insert following
line:

select tea.FDATE into ldTeaDate2 from ... tea where tea.ID = ldTeaId;

the error message:
ORA-01403: no data found
ORA-06512: at "...", line 70

The table and variables are created by the same user, who execute the
statement.

Have anyone an idea?
include theis statement in block with exception handler section.

--
wbr,
Wit.


Reply With Quote
  #3  
Old   
Odd Morten Sve?s
 
Posts: n/a

Default Re: SQL-Proceudre: SELECT ... INTO... within a while loop - doesnīt work - 07-18-2004 , 03:33 PM



bertholomaeus (AT) yahoo (DOT) ca (bert) wrote in message news:<ea3b40c.0407160615.253a680c (AT) posting (DOT) google.com>...
Quote:
Hi,

I want to insert the result of a select into a procedure-variable
within a while-loop. The loop works as far as I donīt insert following
line:

select tea.FDATE into ldTeaDate2 from ... tea where tea.ID = ldTeaId;

the error message:
ORA-01403: no data found
ORA-06512: at "...", line 70

The table and variables are created by the same user, who execute the
statement.

Have anyone an idea?
Well, as the message says, there is no data to match your query.

So I don't know your exact problem. If there is expected to be no data
in every loop you have to write a no_data_found exception. And handle
the exception there.

If you except thre should be data there it is hard for me to gess wat
your problem is. You could try running just the query in sql*plus to
verify that it is correct.

Just a few gess what could cause this problem

Matching against NULL

EG. if a = NULL
and b = NULL
then the boolean (a = b) = NULL which is not FALSE or TRUE
To solve this you could use nvl() statments, outer joins or OR in your
WHERE clause.

Not commited changes. If the insert statments to the table are done in
another session than the pl/sql prgram is run, the later session wil
not see the chsnges of the first session until they are commited.

Regards
Odd M


Reply With Quote
  #4  
Old   
Niall Litchfield
 
Posts: n/a

Default Re: SQL-Proceudre: SELECT ... INTO... within a while loop - doesnīt work - 07-19-2004 , 03:12 AM



bertholomaeus (AT) yahoo (DOT) ca (bert) wrote in message news:<ea3b40c.0407160615.253a680c (AT) posting (DOT) google.com>...
Quote:
Hi,

I want to insert the result of a select into a procedure-variable
within a while-loop. The loop works as far as I donīt insert following
line:

select tea.FDATE into ldTeaDate2 from ... tea where tea.ID = ldTeaId;

the error message:
ORA-01403: no data found
ORA-06512: at "...", line 70

The table and variables are created by the same user, who execute the
statement.

Have anyone an idea?
There are no records in the tea table that meet your where clause.

You ought to catch any exceptions that this code could throw

The two that spring to mind are no data returned (which you have hit)
and exact fetch returns more than requested number of rows (when you
return more than one record).

Niall Litchfield
Oracle DBA
Http://www.niall.litchfield.dial.pipex.com


Reply With Quote
  #5  
Old   
Ed prochak
 
Posts: n/a

Default Re: SQL-Proceudre: SELECT ... INTO... within a while loop - doesnīt work - 07-19-2004 , 11:56 AM



bertholomaeus (AT) yahoo (DOT) ca (bert) wrote in message news:<ea3b40c.0407160615.253a680c (AT) posting (DOT) google.com>...
Quote:
Hi,

I want to insert the result of a select into a procedure-variable
within a while-loop. The loop works as far as I donīt insert following
line:

select tea.FDATE into ldTeaDate2 from ... tea where tea.ID = ldTeaId;

the error message:
ORA-01403: no data found
ORA-06512: at "...", line 70

The table and variables are created by the same user, who execute the
statement.

Have anyone an idea?
How about you read the error message: the SELECT found NO DATA.

You'll need to add some EXCEPTION processing to your code. Look it up
and try it.

And I'd suggest you post any follow up questions in
comp.databases.oracle.misc since the comp.databases.oracle group is
supposed to be obsolete.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.