Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> How to log on from within a function ?
Hi folks,
I am trying to validate a user from within a function. In SQL and SQL*Plus I
can state:
Connect user/passwd_at_database;
However, when using the keyword 'connect' in the function below it won't compile. I will receive an error stating: PLS-00103: Encountered the symbol "Connect" when expecting one of thefollowing: begin, declare,exit, for.....
CREATE OR REPLACE FUNCTION itc_sm_authenticate (user_id VARCHAR, passwd
VARCHAR) return VARCHAR AS
test_val REAL; /* not really needed, just following somesyntactical examples
*/
BEGIN
connect user_id/passwd_at_db_x; /* this doesn't seem to be a valid
statement */
return user_id; /* valid login returns the submitted user_id */
EXCEPTION
WHEN LOGIN_DENIED THEN
return NULL; /* Exception thrown by bad login, returns NULL */
END itc_sm_authenticate;
I'm trying to trap a bad login via LOGIN_DENIED exception and return the user_id for a valid login. How can I "test" a logon from within a function?
Any help is appreciated.
Chris :-)
cermlich_at_swri.edu
Received on Thu Feb 10 2000 - 09:26:20 CST
![]() |
![]() |