• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

Oracle 10g stored procedures: making a simple thing a PITA

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

magellan

Member
Joined
Jul 20, 2002
I've written stored procedures for both SQL server 2000 and MySQL and never had to use
a cursor to return a result set (i.e. more than one row of data). In Oracle 10g you have to
use a cursor. I also had to define a whole f'ing package with a defined record
for the cursor just to create a dead simple stored procedure. In Oracle 10g to return a
single row of data from a stored procedure you have to use local variables and the INTO clause.

Does the reason for all these extra procedural steps have something to do w/enhancing
security?
 
I couldn't say if it is due to extra security, but I do know that all the SQL languages predate the standardization of SQL so they all have their quirks that they have to keep to be able to support older scripts. So when going from one Database to another be aware that things could be weird compared to what you are used to.
 
You're going to have to be a lot more specific about what you're doing that "requires" a cursor - DBMS_SQL provides various table types, and you can define your own with matching %ROW_TYPE or %COLUMN_TYPE, and there's SELECT COL INTO VAR, etc.

The reason for all the steps is because SQL is not an "object oriented" language. The data types are entirely separate from the actual data. Where in Java you might have SomeClass that has several members with various types, in SQL you just have the name "SomeClass", and a bunch of data that goes in it, and then another location that lists what each of those data items in a SomeClass record are.
 
Back