Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

9i Stored Procedure question 1

Status
Not open for further replies.

euntair

Programmer
Sep 13, 2007
53
US
What am I missing? The statement itself is straight forward

Error: PLS-00428: an INTO clause is expected in this SELECT statement
Line: 6
Text: select id,first,last,company,address1,address2,city,state,zip,phone,email,passcode,answer from butlermfg.accounts where id=v_id;


procedure edit_account(v_id in integer)
is
begin
select id,first,last,company,address1,address2,city,state,zip,phone,email,passcode,answer from butlermfg.accounts where id=v_id;

end;
 

What do you not understand about "Error: PLS-00428: an INTO clause is expected in this SELECT statement"?

Check out your PL/SQL Manual. [3eyes]




----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
...Having an into keyword in a select statement. I am more familiar with into being in an input statement.
 
Euntair,

It appears that you are used to the procedural-coding syntax for another database language (perhaps SQL Server, Sybase, et cetera). Oracle's PL/SQL syntax for accessing tables does not identically come across from other environments.

I know that in SQL Server environments, using code similar to your code is a standard methodology, but if you explain what you are hoping to do (functionally) with the code, we can probably suggest an easier way in Oracle.

For the time being, one of the methods to get past your existing error (syntactically) is:
Code:
procedure edit_account(v_id in integer)
is
    x butlermfg.accounts%rowtype;
begin
   select * into x from butlermfg.accounts where id=v_id;
end;
/
...and then you can refer to/access each individual field from within the PL/SQL block as...[ul][li]x.id,[/li][li]x.first,[/li][li]x.last,[/li][li]x.company,[/li][li]x.address1,[/li][li]x.address2,[/li][li]x.city,[/li][li]x.state,[/li][li]x.zip,[/li][li]x.phone,[/li][li]x.email,[/li][li]x.passcode,[/li][li]x.answer[/ul]But again, if you describe what you are trying to do with this procedure, we can suggest a much easier method from within the Oracle World.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services: www.dasages.com]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top