If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Oracle > select inside a procedure

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-02-09, 13:51
nandinir nandinir is offline
Registered User
 
Join Date: Jul 2005
Posts: 276
select inside a procedure

Will I be able to do a simple select inside a procedure like below-

procedure test
begin
select * from test_table;
end;

or should the select always have an into clause like below -

procedure test
begin
select abc from test_table
into abd;
end;

I'll appreciate any input on this.

Thanks,
Nandinir
Reply With Quote
  #2 (permalink)  
Old 07-02-09, 14:57
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,455
Cool Into

Inside a procedure you need the INTO clause.
Code:
abc varchar2(10);
BEGIN
  SELECT col1 INTO abc
     FROM MyTable;
END;
/

PS: I recommend you actually READ the fine Oracle® Database PL/SQL User's Guide and Reference manual.
.
__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

Last edited by LKBrwn_DBA; 07-02-09 at 15:01.
Reply With Quote
  #3 (permalink)  
Old 07-02-09, 21:48
anacedent anacedent is offline
Registered User
 
Join Date: Aug 2003
Location: Where the Surf Meets the Turf @Del Mar, CA
Posts: 6,407
>SELECT col1 INTO abc FROM MyTable;
Use of syntax above limits rows returned to 1.
__________________
You can lead some folks to knowledge, but you can not make them think.
The average person thinks he's above average!
For most folks, they don't know, what they don't know.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On