Skip to Main Content

APEX

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!

I need to use a reserved word as parameter name in proc called from URL

629166Jul 25 2009 — edited Jul 29 2009
Let me preface this post by saying I already know this is terrible to attempt, but it's short term fix only.

Ok, so I have to create a procedure that will be called by a vendors application via a API that calls our URL to send data over. The terrible part is
that the API they have uses the parameter FROM=vendor_data A change is on the way so in the future the API won't use FROM as a paramter, so this isn't something I want to do, but it's a workaround.

So the nastiness is this..., I can create a procedure that'll compile when I enclose FROM in double quotes "FROM" as my input parameter
but if I try to call my procedure via URL (as their application will do) the procedure isn't working. I searched for someway to do an inline
replace of the FROM parameter to something else, but no luck. I'm open to all positive comments. I cannot go outside of Oracle
to do this, so I can't call a shell script and replace. Basically I need some way to use a reserved word as a parameter name, and then be able to call
that proc from a URL, or someway to change the FROM in the URL inline. Any help on this admittedly whacky situation would be appreciated much.

I tried ...\myproc?from=text
...\myproc?"from"=text
...\myproc?'from'=text

proc is simple test procedure

create or replace procedure myproc
("from" in varchar2 default 0)
is
v_from varchar2(30);
begin
v_from:="FROM";
insert into test(col1) values(v_from);
end;

**** Update
I didn't get any more replies but came to a solution that I thought I'd post. It's much better, more elegant and maybe can help others.

So instead of using FROM as the parameter name I did some research and decided I can use flexible parameters. Basically you end up having
2 input parameters for a procedure, one holds a parameter name the other holds the parameter value. They get loaded into arrays
and you access the values with regular name_array(1), value_array(1), etc. ?v=parameter&v2=value

Once I figued I could use flexible parameter it took me tons of research to find out the actual syntax. I'll post some examples for others
later, but was suprised with the lack of resources consideriing how "flexible" they are.

Thanks again for the replies. Cheers.

Edited by: Mitz on Jul 29, 2009 11:37 PM

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Aug 26 2009
Added on Jul 25 2009
5 comments
841 views