on 04-26-2012 12:44 PM
Hi,
I am new to hana. My Task is to convert some oracle plsql procedures to hana stored procedures. The oracle procedure uses objects and table objects as parameters. I have the following questions:
1. Can we declare objects in HANA like the way we do in oracle?
2. How to store data into a variable from a table type IN parameter in a stored procedure ? Can somebody share the sample code ?
Thanks,
RENOO
Renoo:
Here is a sample:
CREATE TYPE DEVGUIDE.PCPTYPE AS TABLE (LOCATION NVARCHAR (60), ANNUAL_PRECIPITATION
REAL);
CREATE PROCEDURE DEVGUIDE.GETCOLDPRECIPITATION (IN LOW_TEMP INTEGER, OUT PRCPT
LANGUAGE SQLSCRIPT READS SQL DATA WITH RESULT VIEW DEVGUIDE.PROCVIEW AS
BEGIN
PRCPT = SELECT LOCATION, ANNUAL_PRECIPITATION FROM DEVGUIDE.LOCAL_CLIMATE WHERE
TEMPERATURE_LOW = :LOW_TEMP ;
END;
CALL DEVGUIDE.GETCOLDPRECIPITATION(-2, null );
Regards,
Rama
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Ravi.
When you get a chance, please can you share your thoughts on a wierd error that I am getting using the procview?
Please review http://scn.sap.com/message/13224220 blog and respond.
Rama
Ravi,
I have a similar requirement, but not for a proc with OUT parameter , but IN parameter of Table type.
In oracle I can declare and populate a PLSQL Table (collection) variable and can pass that as parameter while invoking other procs.
Similarly, Is there a way to declare, initialize /populate and use a table type variable in hana SQL script?
If yes please let me know.
Thank you & Happy new year,
kind regards
K Sudhakaran
Hi Renoo,
If I understand correctly, you are looking for something like Object in Oracle which is nothing but a structure with column definitions. The object can later be used as TYPE and you can instantiate it to store data.
Secondly Objects in Oracle can also be used in the Table definitions.
You have a similar concept in HANA for Table Type, ONLY difference is you cannot store data in TABLE TYPE. You can use a defined table type in the procudure and can create objects to temporarily store data and NOT persist it in the database.
Also I don't think you can use Table types in Table definitions.
You can refer to the SQL Script manual for the examples of the same.
Regards,
Ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.