wood burning stoves 2.0*
The moose likes JDBC and the fly likes How to create a procedure in oracle 10g to fetch an entire row Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to create a procedure in oracle 10g to fetch an entire row" Watch "How to create a procedure in oracle 10g to fetch an entire row" New topic
Forums: JDBC Oracle/OAS
Author

How to create a procedure in oracle 10g to fetch an entire row

gavin sharma
Greenhorn

Joined: Sep 30, 2013
Posts: 12
I am new to Pl/SQL. I want to create a procedure which will take employe id as parameter and fetch entire row with 7 columns. I tried using the below code but it gives error "Invalid Identifier" when i try to execute it. please tel me how to go about it.
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3610
    
  60

In PL/SQL, you cannot just select from a table. You need to somehow process the result of the select. In your case, you'll probably want to store it in a variable that can hold the entire row of the MYADMIN table.

Furthermore, there's no need to use dynamic SQL (the execute immediate) in this case. And if you do, you need to process bind variables correctly. The 'Invalid identifier' error is probably caused by including the empid variable in the command text.

So the procedure with the above suggestions incorporated would probably look like this:
 
GeeCON Prague 2014
 
subject: How to create a procedure in oracle 10g to fetch an entire row