Passing parameters to oracle query
Hi Everyone,
I'm a newbie to oracle and need help passing parameters to an oracle query. For example, I need to show all the employees in a certain department.So a list of "DEPT_CODE"'s will be displayed on a webpage and then the selected value will be passed to the query. I currently have this query in MS Access and use the bracket for user input ("[Dept]"). But how can this be done in oracle?
I am using ASP.NET 2.0 and Crystal Reports XI. Basically I have a webform where users can select the date range and department from a listbox. When the submit button is clicked, the values are passed to the query in crystal reports. For example, I have a query with "DEPT" as a parameter. So I pass the value of the selected listbox item from the webform to the crystal report. But now I have to select data from an oracle database and provide parameters. This is where I need help.
Thanks in advance
-Sam
Duplicate post.
Refer to this thread
Passing parameters to oracle query
Similar Messages
-
Does XML approach for passing parameters in the query make the query slow?
Hi,
I am using XML approach for passing parameters in a query. This is running very slow but when I pass comma separated values in parameter, it runs very fast.
So it concludes that we should not use XML approach for passing parameters. Please confirm me that Am I right or wrong?
I have also googled to clear my doubt but not get solution till now. please help me.
Regards,
Sachin914014 wrote:
Hi,
I am using XML approach for passing parameters in a query. This is running very slow but when I pass comma separated values in parameter, it runs very fast.
So it concludes that we should not use XML approach for passing parameters. Please confirm me that Am I right or wrong?
I have also googled to clear my doubt but not get solution till now. please help me.
Regards,
SachinShow us what you are doing, create a simple yet complete example we can run on our Oracle instances.
Then we will know exactly what you mean, and can comment appropriately.
Cheers, -
Passing parameters to oracle rports from oracle forms
Dear all,
Can anyone tell me how to pass parameters from oracle forms 10g to oracle reports 10g ,i want to hide my connection string and parameteres while open the report through web
can anyone plese help me out to solve this problem.Hi,
I had trail as advised, but anticipated results were not observed.
Here is the named configuration in formsweb.cfg
[NMPT]
form=D:\NMPT\FORMS\FHOPENFORM.fmx
userid=hmsprod/hmsprod@hindalco
WebUtilLogging=off
WebUtilLoggingDetail=normal
WebUtilErrorMode=Alert
WebUtilDispatchMonitorInterval=5
WebUtilTrustInternal=true
WebUtilMaxTransferSize=16384
imageBase=CodeBase
separateFrame=True
lookandfeel=oracle
logo=none
splashScreen=no
pageTitle =Test Application
background=no
colorScheme=blue
archive_jini=f90all_jinit.jar,icons.jar,frmwebutil.jar,jacob.jar
archive=f90all.jar
height=768
width=1024
envFile=nmpt.env
otherparams=useSDI=yesLOCATIONID=NMPT # new parameter which I want to access in my form
the URL is as follows:
http://MyPC:8888/forms90/f90servlet?config=NMPT
But I am unable to open the login page -
How to pass runtime parameters to Oracle Query from xMII server
Please can anybody help me that how to pass runtime parameter to Orcle Query from xMII server.
It works the same way as I described in this thread [How to pass runtime parameters to MySQL Query from xMII server]. It does not matter the datasource MII will work the same for all queries, at least for passing in parameters. How to write those queries and their datatypes will be the differences.
-
Passing parameters for a query throught XML and capturing response in the same
Hi All,
I have defined a RequestParameters object and i am passing paramerts for a query through XML and trying to capture the result in the same and send back to the source. In this case i am send XML from excel.
Below is my XML format.
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Insert xmlns="http://tempuri.org/">
<dataContractValue>
<dsRequest>
<dsRequest>
<SOURCE></SOURCE>
<ACTION>Insert</ACTION>
<RequestParams>
<RequestParams>
<ACC_NO>52451</ACC_NO>
<EMP_CITY>HYD</EMP_CITY>
<EMP_NAME>RAKESH</EMP_NAME>
<EMP_CONTACT>99664</EMP_CONTACT>
<EMP_JOM>NOV</EMP_JOM>
<EMP_SALARY>12345</EMP_SALARY>
</RequestParams>
<RequestParams>
<ACC_NO>52452</ACC_NO>
<EMP_CITY>HYD</EMP_CITY>
<EMP_NAME>RAKESH</EMP_NAME>
<EMP_CONTACT>99664</EMP_CONTACT>
<EMP_JOM>NOV</EMP_JOM>
<EMP_SALARY>12345</EMP_SALARY>
</RequestParams>
</RequestParams>
</dsRequest>
<dsRequest>
<SOURCE></SOURCE>
<ACTION>Update</ACTION>
<RequestParams>
<RequestParams>
<ACC_NO>52449</ACC_NO>
<EMP_CITY>HYD1</EMP_CITY>
<EMP_NAME>RAKESH1</EMP_NAME>
<EMP_SALARY>1345</EMP_SALARY>
</RequestParams>
<RequestParams>
<ACC_NO>52450</ACC_NO>
<EMP_CITY>HYDer</EMP_CITY>
<EMP_NAME>RAKEH</EMP_NAME>
<EMP_SALARY>1235</EMP_SALARY>
</RequestParams>
</RequestParams>
</dsRequest>
</dsRequest>
</dataContractValue>
</Insert>
</s:Body>
</s:Envelope>
Where i have a List of dsRequest and RequestParams, where i can send any number of requests for Insert,Update. I have two a XML element defined in RequestParams "RowsEffected","error" where the result will be caputred and is updated
to the response XML.
I have 6 defined in RequestParams
EMP_SALARY(int),ACC_NO(int),EMP_CITY(string),EMP_NAME(string),EMP_CONTACT(string),EMP_JOM(string)
My Question is:
When i am trying to build response XML with the following code, the parameters which are not given in the Request XML are also appearing in the Response.
ResponseParams.Add(
newdsResponse()
ACTION = OriginalParams[a].ACTION,
SOURCE = OriginalParams[a].SOURCE,
Manager = OriginalParams[a].Manager,
RequestParams = OriginalParams[a].RequestParams
Where the OriginalParams is dsRequest
Ex: In my update query i will only send three parameters, but in my response building with ablove code, i am getting all the variables defined as INT in the RequestParameters.
Is there any way i can avoid this and build response with only the parameters given in the Request ??
Appreciate ur help..Thanks
Cronsey.Hi Kristin,
My project is, User will be giving the parameters in the excel, and using VBA, the values are captured and an XML is created in the above mentioned format and is send to web service for the Insert/Update.
I created a webservice which reads the values from <datacontract> and it consist of list of <dsRequests> where any number of Insert/Upate commands can be executed, with in which it contains a list of <RequestParams> for multiple insertion/Updation.
//function call
OriginalParams = generator.Function(query, OriginalParams);
where OriginalParams is List<dsRequest>
//inside function
command.Parameters.Add()// parameters adding
int
val = command.ExecuteNonQuery();
after the execution,an XML element is added for the response part.and it is looped for all the RequestParams.
OriginalParams[i].Result.Add(
newResult()
{ ERROR = "No Error",
ROWS_EFFECTEFD = 1 });
//once all the execution is done the response building part
for(inta
= 0; a < OriginalParams.Count; a++)
ResponseParams.Add(
newdsResponse()
Result = OriginalParams[a].Result
QUEST: When i am trying to build response XML with the following code, the parameters which are not given in the Request XML are also appearing in the Response.
Ex: In my update query i will only send three parameters, but in my response building with ablove code, i am getting all the variables defined as INT in the RequestParameters.
Is there any way i can avoid this and build response with only the parameters given in the Request ??
Appreciate ur help..Thanks
Cronsey. -
Passing parameters to select query in DB link from invoke...
I am having a DB partner link which executes the select query based on user specified parameter.
Now i have created an invoke activity and specified input[this needs to be passed to query] and output parameters[this is query result]. This invoke activity calls DB partner link in which one parameter has been created to be used in select query. So my doubt is , will DB partner link take up the input parameter of invoke activity automatically or do we need to specify any mapping for this?When you create a db partnerlink the parameter you create for your select is the input and when you create the input variable in the invoke for this partnerlink it is created with the right type for the parameter.
Create an Assign before your invoke and assign a value to the input variable you created in the invoke. That value will be passed and used as the parameter in the select.
Heidi. -
How to pass parameters to Xacute Query
hai all,
Can we pass parametes to Xacute Query using java script with out using any applet in the page..
Thanks,
VidhyaHi Vidhya,
use this function
service.useService(http://"hostname"/Lighthammer/Illuminator?QueryTemplate=Querytemplatpath&Content-Type=text/xml&Param.1=Param",_"Service1");
Hope That helps,
Regards,
Musarrat
Edited by: Musarrat Husain on Mar 4, 2008 2:22 PM -
Passing Parameters to Oracle Function
Hi,
I am very new to BI Publisher and have following concern,
I have a Procedure in a Oracle Package which would return a Number, I need to use that as a Form field in my .RTF template, Could you please let me know whether I can use like this.
<group name="G_ITEM_DETAILS" source="Q_Container_Item_Query">
<element name="DISPLAY_WEIGHT" value="PKG_REPORTS_FUNCTIONS.Display_Weight_formula(:catch_weight,:pick_type,:item_weight, :container_weight, :item_weight number,:unit_qty number))" function=""/>
</group>
the parameters which i am passing will all come from Q_Container_Item_query Query.
Regards,
Ashoka BLI managed it myself...
<sqlStatement name="Q_DISPLAY_WEIGHT">
<![CDATA[
Select PKG_REPORTS_FUNCTIONS.Display_Weight_formula(:catch_weight,:pick_type,:item_weight, :container_weight, :item_weight ,:unit_qty) G_DISPLAY_WEIGHT from dual
]]>
</sqlStatement>
Created a SQL Statement and used a group like following.
<group name="G_DISPLAY_WEIGHT" source="Q_DISPLAY_WEIGHT">
<element name="DISPLAY_WEIGHT" value="G_DISPLAY_WEIGHT"/>
</group> -
Ho wto Dynamically Pass Parameters to a Query in Discoverer
Hi All,
I have a Query where I would to like to pass the Parameters Dynamically.In my query I have three selects and two UNION ALL's.In the three selects I have to pass Period & Year Parameters.In Each Select the Period Calculation is Different.Say in first & second select from the passed period parameter I calculate the previous Months.Whereas in the last select I do the the calculation with the Passed Period.How is it Possible with Discoverer..
Thnx in Advance
Rgds,
Sai SrivatshavHi,
Well there is no straight forward way to do that.
There is a work around to get that functionality by using outer tables or context.
Take a look at the following posts:
Re: Parameters in SubQuery
Re: Parameters in Discoverer Administration
Re: Passing multiple parameters into Custom Folder... -
Passing parameters from oracle form to html
Hello,
I have an application that requires me to take data from an oracle web form and pass many fields as parameters into an html table.
Is this possible?Hi Rose,
There is a specific sample form for this kind of actions in the Oracle9i Forms Demos. It is called Save2HTML.
from the help file: F90Write.Write_HTML Description
Writes the data from the specified block to a file in HTML format.
Maybe you can alter the code for your own use.
succes,
Mark -
Passing parameters from oracle form to the outside Environment ??
i hava an application in
c:\program files\sms app\sms.exe
this application can run in command prompt and accepts parameters to send sms to customers
example of command to send sms from command prompt(cmd) ,
- i navigate to application path c:\program files\sms app\sms.exe and run command below
sms.exe /p:+1012121212 /m:"message body goes here" /l /t
my question is how can i implement a form contains two text box items & one button
in button press trigger i want code that can pass the textbox1.text to the
command line application sms.exe /p:textbox1.text in the parameter position which accepts the phone_number like above example
and pass the textbox2.text to the other parameter in application which accepts message_body with "" _Double caution marks around the message body
so the final command line will look like this :
Application_Path\sms.exe /p:+1012121212 /m:"message body goes here" /l /t
Notes:
textbox1.text = parameter_data_type = number
textbox2.text = parameter_data_type = varchar2
Oracle Developer Suite 10g , OS:Windows 7
Thanks you very muchthanks for replay poelger ,
can y tell me the full command which i'll use ????
the problem is to escape the "",/ characters ,, so the final result will look like this
Application_Path\sms.exe /p:+1012121212 /m:"message body goes here" /l /t
the host needs to check for the operating system??
Again Thanks.. -
Passing parameters to oracle stored procedure in business objects universe
Hello,
Wanted to create a web intelligence usind oracle stored procedure.
Create the following SP
create or replace procedure proc_name1
proc_freq in number,
proc_cur1 in out sys_refcursor
as
begin
INSERT INTO
cc VALUES
( 'Frequency Value = ' || proc_freq, SYSDATE) ;
COMMIT ;
--daily
if(proc_freq = 2) then
open proc_cur1 for SELECT
EVENT_DATE
FROM rqm_mapsigng_dly_stats;
end if;
end;
tried using the above SP in universe, it is needed to pass the parameter for proc_freq, when i pass value 2 , in oracle it is passed as 0(is being traced in rqm_checkpoint table)
Hence the table cannot be inserted in the universe.
Can anyone tell why the value is not being passed correctlyI believe when you're doing it with an insert, you're saying "execute this insert statement a bunch of times, here's all the values in advance", which is different than passing an array to a stored procedure where you want it to execute once.
Oracle's ODBC driver doesnt support Associative Arrays (aka index-by tables).
Hope it helps,
Greg -
Passing Parameters to SQL Query and Displaying Result
The user enters a serial number in a text box and then pushes a button to get info about the serial number. I do this with two regions. The first region has the text box and the button. The second region is a Report type region and contains the following SQL:
select case
when "WARRANTYSTATUS"."OUTOFWARRANTYDATE" >= sysdate then
'Serial Number '||"WARRANTYSTATUS"."SERIALNUMBER"||' is in warranty.'
else
'Serial Number '||"WARRANTYSTATUS"."SERIALNUMBER"||' is out of warranty.'
end as "The result is:"
from "WARRANTYSTATUS"
where "WARRANTYSTATUS"."SERIALNUMBER" in (:P1_SERIALNUMBER)
For a single serial number of the form CU5-0799 every thing works. I am a little suprised this works because the SERIALNUMBER in the WARRANTYSTATUS table is of type varchar2 which means the serial number in the where clause must be surrounded by single quoties. Not sure where the single quoties are being added.
However, what I like to do is to enter more that one serial number, seperated by commas, in the same text box, and then the query return a result for each serial number. What I would like to enter is:
CU5-0799, CU5-07132, CU5-89345
The problem is this string of three serial numbers will needs to be have single quotes around each serial number at the level of the sql statement. So the question is how do I make this work?? Thanks for the help in advance.Bob,
If you would change your OTN handle to something more mnemonically friendly, that would help us. Thanks.
This topic is addressed fully, with various techniques described, here: Re: Search on a typed in list of values .
I am a little suprised this works because the SERIALNUMBER in the WARRANTYSTATUS table is of type varchar2 which means the serial number in the where clause must be surrounded by single quoties.
Not true. Quotes are used for literals, not bind variables.
Scott -
SOURCING10: Passing parameters to a Query Based webservice using JAVA
Hi Experts,
I have been working on consuming a Query based webservice published in Souricng10 in a simple JAVA class. The query has a filter parameter which is not mandatory. I am able to consume the webservice using the GET method and display the content of the webservice. But when i try to POST a value to the filter parameter of the query i am getting the following error:
java.io.IOException : Server returned HTTP response code: 415 for URL: http://sapcild9.web.bc:55000/sourcing/ngservices/rest/query/Z_TEST_WS_QUERY/execute/
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
Following is the code which i have used:
URL url = new URL("http://sapcild9.web.bc:55000/sourcing/ngservices/rest/query/Z_TEST_WS_QUERY/execute/");
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setRequestProperty("Authorization", "Basic " + authStringEnc);
connection.setRequestProperty("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
connection.setRequestProperty("Content-Length", "" +Integer.toString(urlParameters.getBytes().length));
connection.setRequestProperty("Content-Language", "en-US");
connection.setUseCaches (false);
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setAllowUserInteraction(true);
connection.setInstanceFollowRedirects(false);
connection.setRequestMethod("POST");
connection.connect();
//Send request
OutputStream out = connection.getOutputStream();
OutputStreamWriter wr= new OutputStreamWriter(out, "UTF-8");
wr.write("EXTERNAL_ID");
wr.write("=");
wr.write(URLEncoder.encode("temp","UTF-8"));
wr.close();
out.close();
is = connection.getInputStream();
isr =new InputStreamReader(is);
BufferedReader bufferReader = new BufferedReader(isr);
String str; StringBuffer stringBuffer = new StringBuffer();
while ((str = bufferReader.readLine()) != null) {
stringBuffer.append(str);
stringBuffer.append("\n");
System.out.println(stringBuffer.toString());
connection.disconnect();
is.close();
Please Advise how to proceed on this isssue?
Thanks in advance.
Srikanth EmaniHi Gael,
your URL is made up of :
[ProcedureName]?[parameter1]=[value1]&[parameter2]=[value2]
creating URLs like this can have problems especially with spaces and punctuation.
the answer is a FORM
the following will create a hidden form :
FORM ACTION="[ProcedureName]" METHOD="POST" name="F1"
INPUT type="HIDDEN" name="[parameter1]" value="[value1]"
INPUT type="HIDDEN" name="[parameter2]" value="[value2]"
/FORM
you can set the values in the form using:
document.F1.[parameter1].value="abc123%%&&$$!";
document.F1.submit();
will submit the form and the PL/SQL procedure should receive the text as it was contained in the form.
the only characters that can now cause problems are :
" as it delimits the field.
' as it may cause problems in PL/SQL.
\ as it is a special character.
Regards Michael -
Passing Parameters from Forms to Discoverer
Hello Everybody,
Is there a way to pass parameters from Oracle Forms to discoverer 4??
I want to call Discoverer from a Form and pass parameters to a sheet.
ThanksHi,
I don't have 10g right now, so can't test it...
Isn't it possible to just put the params you won't show to your users 'behind' other objects on the param form?
Strange behaviour anyway, in 6i Reports does not seem to care wether the params are on the form or not.
Rgds,
Guido
Maybe you are looking for
-
Can't send or receive mail from certain e-mail address...
Has anyone ever run into an instance where you couldn't send or receive mail to a 1 specific e-mail address? Even after adding the address to your contact list? Here's my situation. There is one person that is trying to e-mail me, but no matter what
-
What type of external microphone do I need?
Do I need to use some sort of USB powered external mic with my iMac in order to do proper dictation and voice commands? I tried a simple plug-in mic and it did not work. Thanks, M
-
Send filr attachment in email, send filr attachment in email
Dear, i want ask, i need send email via iphone 5S IOS 7, and i need send email with attachment, and i need attachment some file, but i not looking menu for this, could you help? Thanks
-
Problems displaying itab with 'REUSE_ALV_GRID_DISPLAY'
Hi experts! I have a problem displaying the internal table itab_test. Itab_uload is a TYPE TABLE of a complex and nested structure I defined in the DDIC. I am able to pass the entries, which are not conform with the specifications, to itab_test, but
-
Flash Crashes on clicking import to stage
I'm having an issue with a blank open document, clicking on 'import to stage' will crash the program or clicking on 'import to library' will crash the program. I have tried uninstalling CS4 and re-installing CS4. The problem remains the same. Any id