I need to use a reserved word as parameter name in proc called from URL
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
Scott,
Thanks for the reply. I'm not familiar with the wwv_flow_epg_include_mod_local, however I know that the
myproc is available via URL. I passed the my procedure name(myproc) on to the dba a while back to make it "accessible" so, I'm assuming that he
added it to this the www_flow_epg_mod_local (assuming this has something to do with access control).
If I modify myproc procedure and remove "FROM" as the input variable, and replace with say,
IN_FROM I can then call the procedure via the URL ./myproc?in_from=test without any problems.
I'm pretty confident that it's the "FROM" that is the hurdle and not a security or setup issue. The proc is fine to call from the URL until I got the curveball that the only available parameter was FROM. How the URL should be when inputing to that parameter?
Edited by: Mitz on Jul 25, 2009 7:36 PM
Edited by: Mitz on Jul 25, 2009 9:16 PM
Similar Messages
-
SQL Developer 1.5 migration issue with MS use of reserved words
In version 1.2 the was and advanced option that allowed the use of reserved words for column names, I can not find that option in 1.5. What happened to this option? I can not find it and I need to port those applications with out changing the column names. I know I can hand edit the scripts but I did not have to do that with 1.2.
Any one know if this can still be done?n 1.2 iIt was under preferences - > Migration -> Advanced, in version 1.5 no advanced options and I searched around and could not find it else where. gulp as for the reserved words ( don't laugh I am just migrating under orders) there are date, number and some columns with embedded / that it barfs on. I am under orders to do it the way it is written.
-
Best practice for the use of reserved words
Hi,
What is the best practice to observe for using reserved words as column names.
For example if I insisted on using the word comment for a column name by doing the following:
CREATE TABLE ...
"COMMENT" VARCHAR2(4000),
What impact down the track could I expect and what problems should I be aware of when doing something like this?
Thank You
BenHi, Ben,
Benton wrote:
Hi,
What is the best practice to observe for using reserved words as column names.Sybrand is right (as usual): the best practice is not to use them
For example if I insisted on using the word comment for a column name by doing the following:
CREATE TABLE ...
"COMMENT" VARCHAR2(4000),
What impact down the track could I expect and what problems should I be aware of when doing something like this?Using reserved words as identifiers is asking for trouble. You can expect to get what you ask for.
Whatever benefits you may get from naming the column COMMENT rather than, say, CMNT or EMP_COMMENT (if the table is called EMP) will be insignificant compared to the extra debugging you will certainly need. -
How Badly Do You Abuse Reserved Words in Column Names
I have a challenge for all you DBA's out there. Most of us agree that reserved words as column names is a bad practice but how clean is your database and some people are quit outspoken about it. Run the following query on some of your custom, non-COTS, databases and post your top 5. You may want to run it in Development to make sure new tables don't violate the best practice. Often we don't think when creating column names or inherited ugly databases, but the fact is, we all have reserved word column names.
Marcus Bacon
SELECT col.column_name , COUNT(1)
FROM all_tab_columns col, sys.v_$reserved_words rwrd
WHERE col.column_name = rwrd.keyword
AND owner NOT IN
( 'SYS',
'SYSTEM',
'MDSYS',
'DBSNMP',
'WMSYS',
'XDB',
'APPQOSSYS',
'OPSG',
'ORDDATA',
'ORDSYS',
'OUTLN' ,
'CTXSYS',
'OE',
'HR',
'TOAD')
GROUP BY col.column_name
ORDER BY count(1) desc,col.column_name;
COLUMN_NAME
COUNT(1)
TO_DATE
32
NAME
21
ID
14
OWNER
9
CLASS
6Hi,
Interesting exercise!
I modified your query, showing separate counts for Oracle, COTS and In-House schemas:
WITH got_developer AS
SELECT CASE
WHEN a.owner IN ( 'APPQOSSYS'
, 'CTXSYS'
, 'DBSNMP', 'DMSYS'
, 'HR'
, 'MDSYS'
, 'OE', 'OLAPSYS', 'OPSG', 'ORDDATA', 'ORDSYS', 'OUTLN'
, 'SCOTT', 'SYS', 'SYSTEM'
, 'TOAD', 'TSMSYS'
, 'WKSYS', 'WMSYS'
, 'XDB'
) THEN 'ORACLE'
WHEN a.owner IN ( 'FUBAR'
) THEN 'COTS'
ELSE 'IN_HOUSE'
END AS developer
, r.keyword
, r.reserved
FROM all_tab_columns a
JOIN sys.v_$reserved_words r ON r.keyword = a.column_name
SELECT keyword
, reserved
, SUM (CASE WHEN developer = 'IN_HOUSE' THEN 1 END) AS in_house
, SUM (CASE WHEN developer = 'COTS' THEN 1 END) AS cots
, SUM (CASE WHEN developer = 'ORACLE' THEN 1 END) AS oracle
, COUNT (keyword) AS all_sources
FROM got_developer
GROUP BY GROUPING SETS ( (keyword, reserved)
, (reserved)
ORDER BY keyword
, reserved
Output from one database:
KEYWORD R IN_HOUSE COTS ORACLE ALL_SOURCES
A N 1 1
ACCOUNT N 2 2
ADMIN N 3 3
ADMINISTRATOR N 3 3
ADVISE N 2 2
ALIAS N 2 2
ALWAYS N 3 3
ATTRIBUTE N 8 34 42
ATTRIBUTES N 11 11
AUTHENTICATION N 3 3
AUTHID N 3 3
BIGFILE N 4 4
VALUE N 8 3 173 184
VERSION N 1 2 124 127
WAIT N 2 2
WHEN N 1 1
WHERE Y 2 2
WRITE N 1 1
XID N 20 20
XMLSCHEMA N 15 15
YEAR N 21 1 22
ZONE N 2 30 32
N 479 182 4253 4914
Y 3 3
479 182 4256 4917
241 rows selected.
Over 85% of the cases (including all 3 of the reserved words (1 ORDER and 2 WHEREs) were in Oracle-supplied schemas.
The most commonly used keywords, outside of Oracle schemas, were
ID (used in 206 tables)
NAME (80)
PERCENT (38)
ZONE (32)
YEAR (22)
TIMESTAMP (18)
USAGE (17)
COST (15)
CLASS (12)
STATEMENT_ID (12)
LOCATION, which was one of your most common examples, only occured 4 times in this database, and OWNER not at all (outside of Oracle schemas). -
I don't have the latest ipod touch and therefore can't download the app '12 days of christmas'. The app details say that you don't need to use a device and that you can "download the gifts from your computer". How do I do this, as I know its not possible to diretly use an app on a computer?
Thanks
ChrisGo to the Purchases Tab in the App Store and Accept the apps.
Then you'll be able to update them.
Regards
TD -
If only using wifi, will I still receive text messages and calls from non iPhone users?
If only using wifi (turning off Cellular Data) will I still receive text messages and calls from non iPhone users?
If you have cell service with a text plan, yes.
-
Need to use Select List value as column name
I want to have a WHERE ? IS BETWEEN ? AND ? clause.
I am using the PL/SQL Query returning a SQL Query as a report. This uses bind variables for items I had set on my form..... If I hardcode something like:
'WHERE STARTDATE IS BETWEEN '||
'TO_DATE(:P1_START,''dd-MON-YYYY HH24:MI'') AND '||
'TO_DATE(:P2_END,''dd-MON-YYYY HH24:MI'')';
I have no problem, but I have 2 date columns, STARTDATE and ENDDATE, and would like to use the value in a select list and not have to hardcode "STARTDATE" in there. I have not been able to do this, does anyone know how to use a bind variable as a column name? From reading some posts I think it might not be possible.Heather,
You're on the right track, just glue in the column name so that it becomes part of the returned query string from the function (...'WHERE '||:COLNAME||' IS BETWEEN '|| ...).
Note that the bind variable is not part of the returned query string, but the column name obtained from the bind variable when the function executes does become part of the query string.
Scott -
I'm having problems using Firefox when opening up PDF files that are called from jsp.
I'm trying to open my billing statement in pdf format. When I click on the link, Firefox 4 takes me to the dowload page and starts to download a readPDF.jsp file. How come Firefox is asking for that? When I use IE 7 I get no problems. Please advise on how to get Firefox to open jsp files automatically.
I have same problem too
-
CreateQuery() using LIKE and % wildcard: wrong parameter Name :(
Hi, I cant find an example of an EJB-QL that uses a LIKE statement and wildcards surrounding a parameter.
I`d tried this:
queryString = "SELECT p FROM Prestadores p WHERE p.nombre LIKE '%?1%'"and also:
queryString = "SELECT p FROM Prestadores p WHERE p.nombre LIKE '%:nombre%'"in ths code.
try {
Query q = em.createQuery("queryString");
//q.setParameter(1, nombre);
q.setParameter("nombre", nombre);
listaPres = q.getResultList();
cargarBusquedaPrestadores(listaPres);
return listaBPres;
} catch (Exception e) {
System.err.println("PrestadoresBean.getDatosPestadorxNombre(String Nombre) Exception Inesperada");
System.err.println(e.getMessage());
return null;
}but i get:
You have attempted to set a parameter at position 1 which does not exist in this query string SELECT p FROM Prestadores p WHERE p.presNombre LIKE '%?1%'or
You have attempted to set a parameter value using a name of nombre that does not exist in the query string SELECT p FROM Prestadores p WHERE p.presNombre LIKE '%:nombre%'.respectively from the SUN App server log.
any help would be appreciated.
Thanks in advance!If you use wildcards inside parameters and fix other bugs the problem will disappear.
Try this:
queryString = "SELECT p FROM Prestadores p WHERE p.nombre LIKE ?1"; //quotes aren't necessary
Query q = em.createQuery(queryString); //Of course there can't be "queryString"
q.setParameter(1, "%" + nombre + "%");
listaPres = q.getResultList(); -
What to do when a table name is a reserved word?
I know the best answer is not to use a reserved word to name a table. But I have no control over that in this situation. I have read that using all Caps and quotations will allow you to use the table name in queries, i.e. "CATEGORY" is suppose to free the table to be used. But that is certainly not working, nor any variation of that formatting.
Does anyone know how to format a reserved word to allow queries?
Thank YouUse double quotes:
SQL> create table ALTER (a number);
create table ALTER (a number)
ERROR at line 1:
ORA-00903: invalid table name
SQL> create table "ALTER" (a number);
Table created.
SQL> desc alter
ERROR:
ORA-00931: missing identifier
SQL> desc "ALTER"
Name Null? Type
A NUMBER
SQL> insert into "ALTER"
2 select level from dual connect by level<=10;
10 rows created.
SQL> select * from "ALTER";
A
1
2
3
4
5
6
7
8
9
10
10 rows selected.BTW CATEGORY is not a reserved word:
SQL> create table category (a number);
Table created.Max
http://oracleitalia.wordpress.com
Edited by: Massimo Ruocchio on Feb 25, 2010 12:32 AM -
Use Long Text as Import Parameter in function module
Hi,
I need to use long text as import parameter and also in tables tab also. Can anybody suggest me the proper data dictionary names?
aRsTry with :
CLTLINE - Text line with language key
CODELINE - coding line
RTLINES
RTFLINES
RFCLINES
RFC_TLINE
TLINE
TLINE10
TLINE11
TLINE12
TLINE13
TLINE14
TEXTLINES
Thanks
Seshu -
Lync Client uses wrong RTP Ports for calls from/to RGS with Agent Anonymity
We have QoS implemented and client ports for audio, video und application defined by Set-CsConferencingConfiguration. We also use firewalls in our LAN between the different VLANs for Clients, Servers and Gateways/SBC. Only RTP from the client with the defined
ports are allowed by the firewall. Media ByPass is enabled.
In all normal cases, the right ports will be used and marked by GPO with the right DSCP value. But if an agent get a call from a RGS which has agent anonymity enabled, the client uses a port in the range 1024-65535 for audio. Also if you make a call on behalf
of the RGS, the client use a random port between 1024-65535. As soon, as the source of the call is in another VLAN (e.g. a call from PSTN which comes in over a SBC in e separate VLAN), the firewall between the two VLANs block the RTP traffic.
We see the deny on the firewall log and in the SBC log we see, the reinvite for the media by pass with the IP of the agent and a not valid port. We also see, that no RTP from the client/agent will arrive the SBC and no RTP from the SBC will arrive the client/agent.
So the call will be disconnected, as soon as an agent wants accept the call.
Is there an additional setting to make sure, the Lync client always use the valid RTP port range?
This behavior exist in Lync 2010 and Lync 2013 clients.Hi Holger,
Thanks for reply!
Sure! I set all AudioPorts on all Services, but the problem are not the ports used by the server, the problem are the ports used by the client. We set the client ports to 49152 with a count of 40. The client (2013 and also 2010) use these ports correctly in all
cases exept for call from/on behalf of an RGS with Agent Anonymity.
If we disable the RGS agent anonymity, restart the client of the agent, then the client uses also the correct source ports for RTP.
I've checked this behaviour now on 3 customer installations, our own productive installation and in our lab.
Because until now only one of our customers have firewalls between the internal VLANs, only this single customer have the issues...
Regards,
Stephan -
How to use reserved word in MAX() function?
Hello, I migrated from SQL Server 7 to Oracle 8.1.7 and have to keep the same tables, columns etc names as it used to be in sql server. One of my tables have colunm called 'Row' and as far as I understand it's reserved word in Oracle
I need to bypass it somehow in the following query:
SELECT MAX(Row)
FROM TableX
I'll appreciate all ideas
Thanks in advance
MarinaHi,
Try one of the following
Select MAX("ROW")
Select MAX("Row")
be careful the double quotes (") make the Row case sensitive.
Regards
John -
Use Enum to Switch on Strings where one string is a java reserved word.
Hi,
I'm having problems switching on a string using enums, when one of the strings is a java reserved word. Any suggestions would be appreciated. Or maybe even a suggestion that I should just be stringing together if-else if and doing string compares rather than a switch.
I've been using the following method to switch on strings.
public enum MyEnum
foo, bar, novalue;
public static MyEnum stringValue(String string)
try { return valueOf(string); }
catch (Exception e) { return novalue; }
Then I can switch like
switch(MyEnum.stringValue( someString )
case foo:
break;
case bar:
break;
default:
break;
Now I have run into the problem where one of the strings I need to use is "int", which is a reserved word in java, so I have to modify.
What is the best way to handle this?
I could just not add it to the Enum and handle it at the switch like this...
switch(MyEnum.stringValue( someString )
case foo:
break;
case bar:
break;
default:
if(someString.equals("int") { ... }
break;
OR...
I could change the Enum, and return intx, by checking if the string is "int". I could check before the valueOf, or during the exception, but I know it's not good practice to use Exceptions in the normal execution of your code... as it's not really an exception.
public enum MyEnum
foo, bar, intx, novalue;
public static MyEnum stringValue(String string)
if(string.equals("int") { return intx; }
try { return valueOf(string); }
catch (Exception e) { return novalue; }
OR...
public enum MyEnum
foo, bar, intx, novalue;
public static MyEnum stringValue(String string)
try { return valueOf(string); }
catch (Exception e) {
if(string.equals("int") { return intx; }
else return novalue;
}My advice is still to not name the enum the same as the value of the string you want to test for. That page I linked to shows how to have enums with parameters. Then you could have an enum whose name is (say) JavaInt and whose string value is "int".
But frankly if I wanted to map Strings to actions I would just use a Map<String, Action> instead of trying to force my code into an antique construction like switch. -
How to convert word doc into pdf - which product of adobe i need to use- what upgrades - am a newbie
How to convert word doc into pdf - which product of adobe i need to use- what upgrades - am a newbie - simple answers please - Thanks in advance.
@Pipeline2007 - which version of Microsoft Office have you got? Older versions of Acrobat aren't compatible with the latest versions of Office, see this link for info:
http://helpx.adobe.com/acrobat/kb/compatible-web-browsers-pdfmaker-applications.html
Maybe you are looking for
-
1. Product Name and Number • HP Elitebook 8570w Workstation 2. Operating System installed (if applicable) • Windows 7 64-bit Hey guys, I want to update to Windows 8 on my notebook and thus I ran the Windows 8 Upgrade Assistant. Spoiler (
-
Computer sleeps during Quicktime playback
When I watch video, my computer goes to sleep after the time I have alloted in my power management settings. This does not happen in VLC or Mplayer. I know that I am not moving my mouse but I am "doing something". This is on my Macmini PPC G4 and I h
-
The file is damaged and could not be repaired.
Hi, I'm debugging an Adobe Drive CC connector and seeking advice on the following problem: After I check-in an Illustrator file, the local copy becomes corrupt. If I make a change and try to save it, I receive a message stating "The file is damaged a
-
Save as file format CSV in Excel
Does anyone know the correct syntax on this one? I have an excel file which should be saved as CSV. This is what I came up with, but it doesn't run. tell application "Microsoft Excel" activate worksheet "worksheet1" set fileSaveName to get save as fi
-
How do i import music from windows media player to I-tunes?
can someone please let me know if there is a way to move all of the music i have in Media Player to itunes. Thank you