473,406 Members | 2,259 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

problem to write connect user command inside the procedure any other option is there

2
hi


i have a problem to connect the user inside the stored procedure in oracle
i tried option

CREATE OR REPLACE PROCEDURE Chk_Permission AS
UserID VARCHAR2(10):='1234';
fname VARCHAR2(20):='franklin';
lname VARCHAR2(20):='baskar';
BEGIN
EXECUTE IMMEDIATE 'CONNECT SYSTEM/manager@almdevp AS sysdba';
EXECUTE IMMEDIATE 'GRANT CREATE SESSION TO dataentry';
EXECUTE IMMEDIATE 'CONNECT jcowner/jcowner';
EXECUTE IMMEDIATE 'GRANT INSERT,SELECT ON PERSON TO dataentry';
EXECUTE IMMEDIATE 'CONNECT SYSTEM/manager@almdevp AS sysdba';
EXECUTE IMMEDIATE 'GRANT dataentry TO appuser';
EXECUTE IMMEDIATE 'CONNECT appuser/appuser';
EXECUTE IMMEDIATE 'INSERT INTO jcowner.PERSON VALUES('||UserID||','||fname||','||lname||')';
EXECUTE IMMEDIATE 'CONNECT SYSTEM/manager@almdevp AS sysdba';
EXECUTE IMMEDIATE 'REVOKE dataentry FROM appuser';
--dbms_output.put_line('welcome');
END;

the above procedure
dataentry is a role it have the collection of privileges( create session, insert, delete etc)

jcowner is a actual schema that contains the person table

appuser is a schema to get the previleges and do the insert operation &

revoke the privileges from the appuser .




is it possible or not. if possible pls help me &


if it is not possible any other option there pls reply this forum.


thanks
Apr 11 '07 #1
1 6034
masdi2t
37
hi


i have a problem to connect the user inside the stored procedure in oracle
i tried option

CREATE OR REPLACE PROCEDURE Chk_Permission AS
UserID VARCHAR2(10):='1234';
fname VARCHAR2(20):='franklin';
lname VARCHAR2(20):='baskar';
BEGIN
EXECUTE IMMEDIATE 'CONNECT SYSTEM/manager@almdevp AS sysdba';
EXECUTE IMMEDIATE 'GRANT CREATE SESSION TO dataentry';
EXECUTE IMMEDIATE 'CONNECT jcowner/jcowner';
EXECUTE IMMEDIATE 'GRANT INSERT,SELECT ON PERSON TO dataentry';
EXECUTE IMMEDIATE 'CONNECT SYSTEM/manager@almdevp AS sysdba';
EXECUTE IMMEDIATE 'GRANT dataentry TO appuser';
EXECUTE IMMEDIATE 'CONNECT appuser/appuser';
EXECUTE IMMEDIATE 'INSERT INTO jcowner.PERSON VALUES('||UserID||','||fname||','||lname||')';
EXECUTE IMMEDIATE 'CONNECT SYSTEM/manager@almdevp AS sysdba';
EXECUTE IMMEDIATE 'REVOKE dataentry FROM appuser';
--dbms_output.put_line('welcome');
END;

the above procedure
dataentry is a role it have the collection of privileges( create session, insert, delete etc)

jcowner is a actual schema that contains the person table

appuser is a schema to get the previleges and do the insert operation &

revoke the privileges from the appuser .




is it possible or not. if possible pls help me &


if it is not possible any other option there pls reply this forum.


thanks

CONNECT is SQLPLUS comment, not SQL command. i think u can execute SQLPLUS command with EXECUTE IMMEDIATE (this statement just for SQL command only)

cmiiw
Apr 13 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Sandie Towers | last post by:
We use a number of similar databases and frequently create a new database using a backup restore of another similar database. We try to keep changes between databases in _Additional tables - like...
0
by: Guy Deprez | last post by:
Hi, i'm having a problem to create indexes. STEP 1 ----------- Connection is OK (you can find the string at the end of the message) Table ("Couleurs") creation is OK STEP 2. Index Creation
6
by: John Morgan | last post by:
I urgently need tom use SP3a upgrade the instance of SQLServer200 MSDE runing on my local machine but I am having problems in doing so. My first problem is that when I start the set up procedure...
1
by: DNKMCA | last post by:
Hi, I'm facing typical problem in SQL Server SP & ASP When ever i try to insert new record, the record has been inserted and gives error " User Already Found" How to solve this issue? Thanks...
3
by: David | last post by:
Hi, Ive been trying to work this out for the past 2 days now and im not getting anywhere fast. The problem i have is that i am using Asynchronous sockets to create a Socket Client library....
9
by: Nathan Sokalski | last post by:
I am trying to connect to a Microsoft Access Database from my ASP.NET Application. I use the following code to create my connection string: cmdSelect.Connection = New...
14
by: bob | last post by:
Can anyone help me connect to SQL Server??? I am new to all this... it is been a titanic struggle consuming hours & days & .... I am trying to create an SQL database programatically. But my...
3
by: Matthew Warren | last post by:
I have the following piece of code, taken from a bigger module, that even as I was writing I _knew_ there were better ways of doing it, using a parser or somesuch at least, but learning how wasn't...
0
by: fbk2k5 | last post by:
hi i have a problem to connect the user inside the stored procedure in oracle is it possible or not. if possible pls help me & if it is not possible any other option there pls reply...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.