Home » SQL & PL/SQL » SQL & PL/SQL » The INTO clause of a SELECT statement of PL/SQL block
The INTO clause of a SELECT statement of PL/SQL block [message #606172] Mon, 20 January 2014 16:08 Go to next message
dancko
Messages: 108
Registered: June 2013
Location: italy
Senior Member
hi at all

can anyone explain me exactly why the executable part of PL/SQL block require the SELECT INTO statement and not simply SELECT statement?

What's the motivation behind the SELECT INTO statement in the executable part of PL/SQL block?

Sorry for the semplicity of question but i'm still too inexperienced to give a response myself.

Sorry for my english.

Thanks.
Re: The INTO clause of a SELECT statement of PL/SQL block [message #606174 is a reply to message #606172] Mon, 20 January 2014 17:10 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
dancko wrote on Mon, 20 January 2014 14:08
hi at all

can anyone explain me exactly why the executable part of PL/SQL block require the SELECT INTO statement and not simply SELECT statement?

What's the motivation behind the SELECT INTO statement in the executable part of PL/SQL block?

Sorry for the semplicity of question but i'm still too inexperienced to give a response myself.

Sorry for my english.

Thanks.


when executing SELECT inside PL/SQL procedure the database needs to be informed to where the results should go to.
This is required since the procedure can be invoked when no client (like sqlplus) is involved (like from a batch job).
Besides PL/SQL itself runs deep inside the database engine & PL/SQL has no concept of displaying any result to terminal.
Re: The INTO clause of a SELECT statement of PL/SQL block [message #606185 is a reply to message #606172] Tue, 21 January 2014 00:19 Go to previous messageGo to next message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

PL/SQL User's Guide and Reference
Application Developer's Guide - Fundamentals


Re: The INTO clause of a SELECT statement of PL/SQL block [message #606188 is a reply to message #606172] Tue, 21 January 2014 00:26 Go to previous messageGo to next message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
dancko wrote on Tue, 21 January 2014 03:38
can anyone explain me exactly why the executable part of PL/SQL block require the SELECT INTO statement and not simply SELECT statement?


From the docs :

"The SELECT INTO statement retrieves values from one or more database tables (as the SQL SELECT statement does) and stores them in variables (which the SQL SELECT statement does not do)."

Read SELECT INTO statement
Re: The INTO clause of a SELECT statement of PL/SQL block [message #606190 is a reply to message #606188] Tue, 21 January 2014 01:02 Go to previous message
dancko
Messages: 108
Registered: June 2013
Location: italy
Senior Member
thanks at all. it's all more clear.
Previous Topic: Rank without analytical function
Next Topic: Issue in Database Link
Goto Forum:
  


Current Time: Thu Mar 28 18:18:16 CDT 2024