I believe the problem here is with statement 8:
execute immediate 'grant'||priv||'to'||usern
PL/SQL does not permit the execution of a DML statement using dynamic parameters. In other words, the interpreter has no way to determine the values off the variables until run time.
You will need to use the dbms_sql package to run dynamic SQL. Here is an example of how this would need to be done.
c1 := dbms_sql.open_cursor;
dbms_sql.parse(c1,'grant'|
rows_processed := dbms_sql.execute(c1);
Read through the Dynamic SQL documentation for other procedures you may need.
Main Topics
Browse All Topics





by: pennnnPosted on 2002-11-01 at 20:57:35ID: 7399323
Assuming that the decrypt1 function work as it's supposed to, the maybe the only problem is the lack of spaces in your sql statement. Try this on line 8:
execute immediate 'grant '||priv||' to '||username;
By the way your function can retun only one value and the first return statement will be the last statement executed in your function. If you need to return more than one value, then you should use OUT parameters.
Hope that helps!