If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Executing SQL Procedure from Read-Only User - Help!!!

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-28-04, 06:04
aneesh_malhotra aneesh_malhotra is offline
Registered User
 
Join Date: Aug 2003
Posts: 1
Question Executing SQL Procedure from Read-Only User - Help!!!

Hi,

I've two queries regarding SQL stored procedures :

(The IBM DB2 Server Version I work on is DB2/LINUX 7.2.0)

Query 1 : How to define my own package for SQL stored procedure ?
I don't know how to control the package in which a SQL Stored Procedure is getting created. Is there a DB2 command equivalent to Oracle's "CREATE PACKAGE" statement?

Query 2 : Is there an "ALIAS" equivalent command for calling SQL Stored Procedure?
I've created 2 db users - 1st user with all privileges - TESTADMIN & 2nd user with only read only privilege - TESTREAD. I have executed a SQL stored procedure called TEST_PROC in TESTADMIN login mode. I want to execute the same from TESTREAD user login. I can execute the command "GRANT EXECUTE ON PACKAGE xxxxx TO USER TESTREAD", & then from the TESTREAD user login, I have to execute "CALL TESTADMIN.TEST_PROC" command. (If it were a table/view, I can use CREATE ALIAS for SCHEMA.TABLENAME & refer the table simply by omitting the schema name.) What I want to know is - Is there a way that I can omit the schema name & just give "CALL TEST_PROC"? (I don't want to use SET SCHEMA statement)

Any help would be greatly appreciated.

Regards
Aneesh
Reply With Quote
  #2 (permalink)  
Old 06-01-04, 01:39
Tony Winch Tony Winch is offline
Registered User
 
Join Date: Jun 2002
Posts: 7
Set FUNCPATH

Aneesh,

In general I would say you can't do what you want in the simple manner you want when you exclude the DB2 command that does it but..

1. Have you tried setting the package name as a BIND variable in development centre when you build the stored procedure?

2. Have tried setting the FUNCPATH as a bind variable as I gather the SET PATH would also not be appropriate for you. You can also set schema and funcpath in the ODBC/CLI config file for the database connection.

Did have time to test these but they may work, I could work exactly what you want question 1 to achieve.

Tony Winch
www.datasync.com.au
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On