Skip to Main Content

Analytics Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Using variables at a procedure

Daniel HeinNov 10 2008 — edited Nov 12 2008
Hello experts,

i'm new in odi but have been doing just fine but i'm not achieving to use variables ate a odi package.
let me explain the issue:

1) i create three variables non-persistents at odi that retrieves value from a sql select statement, like this, for example:

select '<=%odiRef.getPrevStepLog("SESSION_NO")%>'FROM DUAL; (Variable Name-SESS_NO)
select '<=%odiRef.getPOP("POP_NAME")%>' FROM DUAL;(Variable Name-INTER_NAME)
select '<=%odiRef.getPrevStepLog("STATUS")%>' FROM DUAL;(Variable Name-FLAG_STA)
...

2) then i create a odi procedure that insert values in a log table: insert into <table_name> values ('#SESS_NO','INTER_NAME','#FLAG_STA')

3) then i create a package that has the follow steps:

Interface (Success) -> Procedure (with the insert statement)

The issue is, where should i put the variables? Wherever i put them, the operator shows me a error message that, at the execution of the insert statement, indicate that the variable does not have value. I try inserting then before the procedure, ( Interface (Success) -> var1 (Success) -> Var2 (Success) -> Var3 (Success) ->Procedure (with the insert statement)) but them, obviously, a error is shown because the previous step of the var2 is var1, where should be the interface.

I try to create a scenario (new package) with the variables and the principal package becomes like this:

( Interface (Success) -> Scenario (new package) (Success)-> Procedure (with the insert statement)

But the error persists and no value is assigned to the variables.

Any help will be gratefully appreciated.

Thanks in advance,

Daniel Hein

Edited by: user10470648 on Nov 10, 2008 4:11 AM
This post has been answered by Cezar Santos on Nov 12 2008
Jump to Answer

Comments

60437
You don't say how you are running the procedure, from within an application or using the SQL Workshop. In the former case the package/procedure will be parsed as the "owner" or parsing schema of your application. In the latter, as the selected workspace schema. It will never, ever be parsed as APEX_PUBLIC_USER.

Scott
Willeja
In Apex the parsing schema is set to 'XGN4'.
We call the procedure in a process on the apex-page.

Is there a way to see which user is parsing the procedure?
Willeja
I used the following to check which user is parsing:

insert into test(test) values('Create Table As: '||USER);

The result (when calling from apex-page) would be 'APEX_PUBLIC_USER'.

Please correct me if I'm wrong...
Willeja
Ok Scott, you are right.
I used sys_context('USERENV','CURRENT_USER') to identify the user and it's the right parsing schema (XGN4).

But why won't my code execute right in apex when it does straight from SQL-DEVELOPER (or another tool)?

Eg:
In toad: EXEC packagename.procedure(parameter);

in Apex: begin; packagename.procedure(parameter); end;

the procedure contains an execute immediate('alter tabel ...') and will do his job in the first case, but returns an error insufficient privs from apex.
60437
Answer
Your application's parsing schema must be granted object and system privileges that it needs using "direct" grants, not grants through roles.

Scott
Marked as Answer by Willeja · Sep 27 2020
Willeja
That did it... Thank you.

Is there a reason why a role isn't good?

The only thing now that isn't working will be the 'ALTER ANY TABLE' privilege.

Edited by: Willeja on Oct 30, 2008 8:33 AM
60437
Is there a reason why a role isn't good?
In Oracle, roles are not enabled during the execution of definer's rights stored procedures which is how you can consider an Application Express application.
The only thing now that isn't working will be the 'ALTER ANY TABLE' privilege.
That's a powerful privilege for your application's parsing schema to have.

Scott
Willeja
That's a powerful privilege for your application's parsing schema to have.








Yes it is, but there are only 2 persons who will use this schema and normally they know what they are doing.



I solved the problem. Alter any table wasn't sufficient because we did:



alter table X add ( column number default 1);



Because of the default we also needed the 'UPDATE ANY TABLE'.



Thank to all your answers...
1 - 8
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Dec 10 2008
Added on Nov 10 2008
8 comments
975 views