on 09-09-2013 11:10 PM
Hi,
I am trying to update a table using a procedure and I tried this from both SQL console and also by creating the procedure from Project explorer option.
I see this message "feature not supported: INSERT/UPDATE/DELETE are not supported in the READ ONLY procedure/function", is there a way to create procedure with update functionality too?
Would any of you guide me if this is a access related message or the update feature is not supported via procedures?
Thanks,
Anil
You also need to enable the ability to create read/write procedures in your HANA system. From the administration console, click on the configuration tab, then expand indexserver.ini then expand repository. Change the value for "sqlscript_mode" to UNSECURE
Cheers,
Rich Heilman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ravi,
I get the below error with this sample code and I am writing this using File --> New --> cerate new procedure where in the procedure is created in the project explorer tab and we can debug this procedure as well.
CREATE PROCEDURE update_proc ( )
LANGUAGE SQLSCRIPT
SQL SECURITY INVOKER
DEFAULT SCHEMA "SYSTEM"
READS SQL DATA AS
BEGIN
/*****************************
Write your procedure logic
*****************************/
INSERT INTO "SYSTEM"."cp_Trend" VALUES ('1020','TP1','PF2','TR1','CN1','10','180','10/1/2012');
END;
2) The below code without SECURITY INVOKER which gives me the privilege error as shown in my previous post:
CREATE PROCEDURE update_proc ( )
LANGUAGE SQLSCRIPT AS
--SQL SECURITY INVOKER
--DEFAULT SCHEMA <schema>
--READS SQL DATA AS
BEGIN
/*****************************
Write your procedure logic
*****************************/
INSERT INTO "SYSTEM"."cp_Trend" VALUES ('1020','TP1','PF2','TR1','CN1','10','180','10/1/2012');
END;
If I write a procedure out of SQL console (which is not a recommended approach from SAP) I would not be able to debug it by setting up a break point so basically I want to write a procedure with INSERT/UPDATE/DELETE and be able to dug it as well. Appreciate any help around this!
Thanks,
Anil
Thanks,
Anil
Hi Rich,
I went in to the SAP HANA System --> Security --> Users and selected "SYSTEM" (I logged in as) and added "_SYS_BIC" and granted all the privileges to this. Still getting the same privilege error message.
Is this because I am trying to generate the data in schema "SYSTEM" and it is not added in the privileges section? It says "feature not supported: grantor and grantee are identical"..not sure how to proceed.
Thanks,
Anil
Hi Anil,
Some comments:
1) Never use SYSTEM user id for application development. This user id is basically for System administration activities and not meant to be used for application development. You are mixing system related information (tables) with application tables (like cp_Trend) and any mistake to insert / update might have impact on your HANA system. So please avoid using SYSTEM for any application related activities.
2) Don't worry about SAP recommendation . These features like repository based development and debugging of procedure is relatively new. Previously (or even now in case of many developers) the SQL code / procedure was created in the SQL console itself. You can see the Database related issues directly there. With repository based development, there could be additional access related issues as all the repository based development is owned by _SYS_REPO user. Hence I'd suggest you to try the code in SQL console also.
3) If you want to insert / update the data, don't use READS SQL DATA. It makes the procedure read only and Insert / updates are not allowed.
4) SQL SECURITY INVOKER, please change it to DEFINER. This way the procedure will use the access rights of the user creating the procedure.
5) In the insert statement, please provide the column names of the table. For ex. Insert into table a (col1, col2) values ('1', 2) ; This will help you understand if there is any data type mismatch or error due to number of values with respect to number of columns.
So my recommendation, is try it in SQL console first, get the basic issues sorted out and then take it to repository for any logic debugging issues.
Regards,
Ravi
Hi Anil,
If you have changed "sqlscript_mode" to UNSECURE and don't use READS SQL DATA in procedure, then you need to check whether you have privilege ( INSERT/UPDATE/DELETE) on this table (cp_Trend) for using system user.
Besids, I also recommend your exec related script on sql console to test it as well, such as insert script.
Regards,
Jerry
Hi all,
Thanks for all your responses. Summing it up I did the following to make my procedure allow DML statements and be able to debug.
1. Per SAP note your procedure must be active in order to debug which means you (at least I ) cannot debug repository procedures create from SQL console, correct me if I am wrong.
You have activated your procedures and they must belong to a project on your local workstation.
2. I have granted the privileges to my user id (though it is SYSTEM in my case) to do debug and execute DML statements too.
3. Create the tables in schema in schema other than "SYSTEM" and execute them to make sure the user name and schema name aren't the same.
Finally got it going.. thanks every one again for your time/effort...Feel free to add your inputs if any!
Thanks,
Anil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.