All,

I am trying to open another session using input parameters passed to the 
procedure.  Can I open a session in a procedure and if so how do I stay in 
the opened session?
Is it possible at all?

I am placing the code that I used.

Appreciate any ideas or suggestions.
Radhika.


create or replace procedure open_session(userid_in  in  varchar2,
                                          password_in in  varchar2)
is
connect_string varchar2(14);
      sql_stmt varchar2(2000);
     curr_user varchar2(20);
cursor_handle integer;
    feedback_v integer;
begin
connect_string := 'xxx_database'; --database connect string.

/* create a cursor to user fo the dynamic sql */
cursor_handle := DBMS_SQL.OPEN_CURSOR;

/*construct the sql statement and parse it. */
sql_stmt := 'connect 
'||userid_in||'/'||password_in||'@'||connect_string||';';
dbms_output.put_line('Constructed SqlStmt is: '||sql_stmt);

/* parse the sql statment */
DBMS_SQL.PARSE
   (cursor_handle, sql_stmt, DBMS_SQL.NATIVE);

/* execute the sql statement */
feedback_v := DBMS_SQL.EXECUTE(cursor_handle);

/* check to see which user is connected */
select user
    into curr_user
   from dual;
dbms_output.put_line(curr_user);
dbms_output.put_line('Feedback'||feedback_v);

/* close the cursor */
DBMS_SQL.CLOSE_CURSOR(cursor_handle);

EXCEPTION
  WHEN OTHERS
  THEN
   /* close cursor on failure */
   DBMS_SQL.CLOSE_CURSOR(cursor_handle);

end validate_user;
/

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Manasa Rao
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to