Hi Santosh,
1. Generaly we feed table types as tabular results in a procedure.
2. Primary key not required for table types
3. ins_msg_proc is not SAP supplied function/proc. We need to define it. Here is the example and can be modified as per your convenience:
CREATE TABLE SCHEMANAME.message_box (p_msg VARCHAR(200), tstamp TIMESTAMP);
CREATE PROCEDURE schemaname.ins_msg_proc (p_msg VARCHAR(200))
LANGUAGE SQLSCRIPT AS
BEGIN
INSERT INTO message_box VALUES (:p_msg, CURRENT_TIMESTAMP);
END;
To view the content, use below statement after running the proc.
select * from SCHEMANAME.message_box;
4.If proc is defined "WITH RESULT VIEW schemaname.viewname AS" clause, you can find the results of your procedure in column views(ProcView) of the schema (schemaname).
ex:
CREATE PROCEDURE schemaname.Proc1(IN id INT, OUT o1 CUSTOMER)
LANGUAGE SQLSCRIPT
READS SQL DATA
WITH RESULT VIEW schemaname.ProcView AS
BEGIN o1 = SELECT * FROM schemaname.tablename WHERE columnname = ......;
END;
5. I think table type variable values exist only during run time. Not really sure about this.
6.To redirect the output of call procedure, is nothing but using "WITH RESULT VIEW schemaname.viewname AS" and can find this in column view of schema.
7.If you want to insert data in a procedure, do not use READS SQL DATA clause. If you use this then becomes read only.
ex:
CREATE PROCEDURE schemaname.Proc2(IN id INT, OUT o1 CUSTOMER)
LANGUAGE SQLSCRIPT AS
BEGIN
write your insert stateement.........
END;
Regards
Raj