Passing Parameter to SQL-Query
Hello ,
i have an SQL Query as Data Source of my Crystal Report . I d like to pass the parameter to my SQL-Query.
Parameter ?city
Query1
select
Order ID,
City, -- How to pass my ?city here
Amount
from Orders,
thanx ..
You can do this by using the 'Add Command' feature.
Click Add Command -> Create your ?City Parameter -> type SQL statement:
select
Order ID
where City='{?City}'
Make sure you add single quotes around your parameter.
Regards,
Zack H.
Similar Messages
-
How to pass parameter to the Query String of the Named Queries'SQL
Firstly to say sorry,I'm a beginner and my English is very little.
Now I want to know
How to pass parameter to the Query String of the Named Queries'SQL in the Map editor.
Thanks.benzi,
Not sure if this is on target for your question, but see #5 in the link below for some web screencasts that show how to pass an input text form field value to the bind variable of a view object. If you're looking for something different, maybe provide some more details such as what you are trying to accomplish and what technology stack you are using - for example, ADF BC, JSF, etc.
http://radio.weblogs.com/0118231/stories/2005/06/24/jdeveloperAdfScreencasts.html
Also see section 5.9 and chapter 18 in the developer's guide.
thanks -
How to Passing parameter in SQL.For Example,Table name=&From_Clause.It will asking table name at runtime.How to assign table name based on user.
Hi,
796776 wrote:
It will returm error.what problem in this
Select * From Emp a,
(SELECT CASE
WHEN USER = :UserType
THEN 'scott.Dept'
ELSE 'scott.order'
END AS b
FROM dual)
Where a.DeptNo= b.DeptNo &WhereClauseIt's hard to guess, from an example like this with so many errors, exactly what you're trying to do.
Please post a description of the problem, including CREATE TABLE and INSERT statments for any tables you need (unless you can state the problem using commonly available tables, such as those in the data dictionary or the scott schema), a few values of a parameter (or examples of different user names, if USER acts like a parameter) and the results you want from the same data for each value.
For example
"In addition to the scott.dept table, I have a table called my_dept: CREATE TABLE my_dept ...
which has this data: INSERT INTO my_dept ...
I need a script such that, when user scott runs it, the results are ...
but when any other user runs it, the results are ..
As you can see, the difference is ..."
Table names must be explicitly given when a SQL statement is compiled. That's why I usggested a preliminary query; so by the time you compiled the main query, the table name would be known and could be passed in a substitution variable.
If you really want to do it in one query, you can do a UNION of two queries, one of which returns nothing because of the parameter. It's not very efficient. -
Can we use formula column in lexical parameter in sql query ...
hi
can we use formula column in lexical parameter in sql query ...
as example
i want to give
select * from & c_table
forumula
function c_table
if :p_sort = 1 then
return 'dept'
else
return 'emp'
end;
c_table formula column
is this possible ...
i have such example in oracle apps reports
if i try in ordinary report usinf emp table it show error ..
how we can give formula column...
please help me in this regard...
Edited by: 797525 on Feb 20, 2012 9:31 PMthanks sir,
iam not exactly saying select * from &c_table but some thing that like columns in select stmt also will be populated in user_parameters ,there are lot of table select.......from mtl_demand md, mtl_system_items msi, mtl_txn_source_types mtst, mtl_item_locations loc &C_source_from &C_from_cat
&c_source_from and &c_from_cat formula column and there are defined at report level only ......
pl/sql code &c_source_from is
function C_source_fromFormula return VARCHAR2 is
begin
if :P_source_type_id = 2 then return(',MTL_SALES_ORDERS mkts');
else if :P_source_type_id = 3 then return(',GL_CODE_COMBINATIONS gl');
else if :P_source_type_id = 6 then return(',MTL_GENERIC_DISPOSITIONS mdsp');
else if :P_source_type_id = 5 then
if :C_source_where is null then
return NULL;
else
return(',WIP_ENTITIES wip');
end if;
else if :P_source_type_id = 8 then return(',MTL_SALES_ORDERS mkts');
else if :P_source_type_id is null then
return(',MTL_SALES_ORDERS mkts,
MTL_GENERIC_DISPOSITIONS mdsp,
GL_CODE_COMBINATIONS gl ');
else null;
end if; end if; end if; end if; end if; end if;
RETURN NULL; end;
this is forumula column i hope that you understand what iam saying
please help me in this regard....
thanking you... -
How to add a parameter to sql query in report
Hi
How to add a parameter to sql query in report.
Parameter is from Visual studio
example:
select * from tab1 where dl=parameter???
I have VS 2008 prof CR XI R2, mysqlHello,
If you have this API available then you can modify the record selection formulae in code to add filtering:
string recordSelectionFormula = "{T_INV_RPT_ADDR.IND_PROMUS} = {?P_PROMUS?} AND {T_INV_RPT_POINT.INVOICE_DATE} = DATE(2008, 05, 31) AND {T_INV_RPT_POINT.CHECKOUT_DATE} = date(2008, 04,29)";
CrystalDecisions.CrystalReports.Engine.ReportDocument.RecordSelectionFormula = recordSelectionFormula;
You have to format and follow the rules as in the Designer so not too much work to get this to work.
CR for .NET may not have the ability so you will need to upgrade to a Developer version of Crystal Reports.
Thank you
Don -
Parameter passing to custom SQL query using PL/SQL FUNCTION
Hi
In order to pass a parameter to the query in custom folder of a business area I created a function and mapped it to the Custome query using Discoverer Desktop. There is no error in mapping as the system does not throw any error. When I am inputting the Parameter for the input values everytime the query doesnot return any rows.
Can anybody help in this regardHi,
I need to take the request Id as input from the user and then fetch only the data pertaining to that requet Id. As a lot of complex joins are involved I need to pass request id as parameter to the custome folder.
The package i greated:
CREATE OR REPLACE PACKAGE SETPARAM
AS
param1 varchar2(25);
param2 varchar2(25);
FUNCTION SET_PARAM1(p1 IN varchar2) RETURN NUMBER ;
FUNCTION GET_PARAM1 RETURN varchar2;
END SETPARAM;
CREATE OR REPLACE PACKAGE BODY SETPARAM AS
FUNCTION SET_PARAM1(p1 IN varchar2) RETURN NUMBER IS
BEGIN
fnd_client_info.set_org_context('138');
param1 := p1;
dbms_output.put_line(param1);
RETURN 1;
END;
FUNCTION GET_PARAM1 RETURN varchar2 AS
BEGIN
RETURN param1;
END;
END SETPARAM;
I registered the set_param1 function as a pl/sql function in discoverer admin.
This function is called on the condition associated with the parameter in Discoverer Desktop when i run the report.
In the custom folder query i have this piece in the where clause
WHERE tnfo.request_id = NVL(APPS.SETPARAM.GET_PARAM1,7383588)
And everytime i get the data pertaining to request id =7383588,
Please suggest where i went wrong
thanks
Ashwini -
I am trying to set up a parameter query using ODBC-Microsoft Query
to BMC Remedy The ODBC connection is "AR System ODBC Data Source".
I want to pass a parameter to modified date field and get all the remedy tickets for which the modified date is<= to the passed parameter date.
So in MS query, SQL-
the query looks like
WHERE ("Trouble Ticket"."Create Date">={ts '2014-10-01 00:00:00'}) AND ("Trouble Ticket"."Modified-date"<=?)
I am getting the data fetched from database in the MS query window, but unfortunately
When I click File-Return Data to Microsoft Excel, its showing an error: Driver]Parameter missing
I set the connection properties- parameter-Prompt for value using the following string.
Please helpHi,
Based on the error message, I recommend we try the suggestion: Replace all "..." with [...]
http://www.pcreview.co.uk/forums/error-parameter-query-odbc-remedy-bmc-software-com-t3232964.html
Then, if you want to connect the Remedy's oracle database, please see the thread:
http://www.tek-tips.com/viewthread.cfm?qid=1123112
We may try the workaround: Write an Excel macro which connects to the database and fetch the data based on the SQL query.
Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.
If you have further question about write macro, I recommend you post the question to the MSDN forum for Excel
http://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev&filter=alltypes&sort=lastpostdesc
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
George Zhao
TechNet Community Support
It's recommended to download and install
Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
programs. -
Hi,
I am using from_date and to_date parameters. Data type and Param type for both are 'Date' and my Format string is 'dd/MM/yyyy'
I need to pass these two values to my data model which is SQL query. Whenever I use below WHERE clause I am getting
"ORA-01858: a non-numeric character was found where a numeric was expected", Please let me know how to fix this error.
trunc(a.scan_timestamp) between to_char(to_date(:p_from_date,'DD/MM/YYYY'),'DD-MON-YYYY') and
to_char(to_date(:p_to_date,'DD/MM/YYYY'),'DD-MON-YYYY')Hello,
if you choose Date for Data type and Parameter Type for the parameters then the format of your date has nothing to do with your selection.
Please try
trunc(a.scan_timestamp) between :p_from_date and :p_to_date
Wolfgang -
Passing variables to SQL query from checkboxes
Hello,
I have a cursor which gets different ids from an id table. The cursor is something like this:
CURSOR id IS
SELECT distinct id_ FROM I
order by id_;I then iterated through the cursor to made checkboxes to choose multiple ids:
FOR i IN id
LOOP
htp.p('<tr>
<DIV align="left"><td><input type="checkbox" name="option" value=ID '||i.id_||'> </td></tr>');
htp.p('<font size="'||3||'">'
ID'||i.id_||'</a></font>'
||'</a>' );
htp.br;
END LOOP;The values of the checkboxes were extracted by:
var ids ="";
for (var j = 0;j < document.form.option.length; j++)
if (document.form.option[j].checked)
ids = ids + document.lf.option1[j].value + "\n";
}I have the following SQL query:
Select * from Persons where Identification = ...; I would like to use to pass the values of the checkboxes (i.e. the variable ids ) to my SQL query. I want the user to select multiple values for the checkboxes. For example, they can select 4 and 3. I want to pass the difference to my SQL query....that is, I want the id to be 1. So, I want this:
Select * from Persons where Identification = 1; Any ideas how to do this? Also my code above is in different procedures within a single package.Your requirement is not very clear. What happens when you select 3 checkboxes? What will be the difference between them? How do you pass that information to the oracle report?
-
Pass parameter to sql statement in query manager
Hai to all,
I want to pass the percentage as the parameter into the sql statemnet.i what to execute it in the query manager.
If i execute that statement then cann't found the tablename error is coming.
Other than the data in the table (general data) pass to the parameter in the sql at runtime.
for example:
select [%0] *100
how to pass 10 to that sql statement.
Please help me...
Regards,
Raji.Hi Ramya,
You can create a SP with parameters to accept and then execut this SP from SAP Business One Query Manager by passing the parameter (in your case 10). The result will be as desired.
Ex:
Create this Procedure in SQL Management Studio
create proc Test(@a as int)
as
begin
select (@a*100)
end
To Execute the Query use this Query and pass the desired values with parameters
execute Test 10
Regards,
Reno -
Jsf and putting parameter in sql query
Hey,I have a database,and I want for the selected checkboxes that a user checks,to get their Ids from the database.I am assuming that I need a query something like this: SELECT person.Id FROM person WHERE person.Id=?. I am using NetBeans for my project.My questions are
1.How do I make the query?Do I use a string with the above value, and then I ask it where?
2.How do I say that the parameter ? would be the Ids of the selected checkboxes?
3.Is there anything else I have to add in the query to make it right?A while function maybe?
Sorry for the question but I am new in the business!1) This question has nothing to do with JSF at all. Are you familair with JDBC and SQL? If not, start reading tutorials/books about that.
2) You can obtain the selected values in the JSF backing bean and pass it through to a DAO class which should obtain data from the DB.
3) Just some background knowledge and understanding. -
Problem with parameter and sql query
I've a problem with te query of my report. The query is:
SELECT [DESCRIPTN]
,[LOGTIME]
,[STATUS]
,[CARDNO]
,[LOGDATE]
FROM [Granta5P0].[dbo].[TIMELOG32]
where cardno in ({?cardNo})
the parameter as multiple values checked so I can query for more than one card.
If i put just one parameter everything works fine but when I put 2 or more I have his error
[http://www.megagaleria.com/pictures/Pic_10074_25.jpg]
I realized that the field as no ' delimiting the parameters, I have a function that already does it but I don't know how to put it in my sql command.
If anyone can help I appreciateYes, because your parameter is only looking for one card.
where cardno in ({?cardNo})
Will you only be creating querys on two cards or less ?
Are you trying to create an Array?
If two or less you could
where cardno = ({?cardNo}) or cardno = ({?cardNo2}) -
Using a URL parameter in SQL Query
Newbie question...
I have been developing a dashboard application, and I have been using input bind variables in the SQL. That all works fine.
What I would like to do is to have a user go to a page via a URL with paramaters like this:
http://atlas:7777/pls/apex/f?p=112:1:9191429456552868531:::::P1_ITM_CD_PASSED:JMINV
where P1_ITM_CD_PASSED is the parameter and JMINV is the value.
Then, I want the SQL to execute using that:
select *
from itm
where itm_cd = ': P1_ITM_CD_PASSED'
I tried testing this on a page. Set up a report region, but it appears that the paramater is not making it to the SQL. "No Records Found".
Is there a simple example out there that anyone knows of? Maybe I am missing an item, computation, process, etc. to be able to utilize the paramater?
Thanks in advancevarad
Thanks for the reply. I did try that, and same results. It seems that the parameter is not getting bound to the variable, or it's getting flushed after the page loads. Here is what debug shows me:
P1_TEST
0.08: show report
0.10: determine column headings
0.10: activate sort
0.10: parse query as: CUSTOM
*0.11: binding: ":P1_ITM_CD_PASSED"="P1_ITM_CD_PASSED" value=""*
0.11: print column headings
0.11: rows loop: 15 row(s)
no data found
Edited by: jmcclain on May 13, 2010 4:01 PM -
Passing parameter to a query in Discoverer Admiin custome folder.
I am developing a report in which I need to paa in the request Id as parameter to display the user the data corresponding to that request Id. However the query is very complex and If I am enetering the request Id in Discoverer Desktop se as Condition for the workbook created the report takes a lot of time to generate. Is there any mechanism through which I can pass the parameter directly to the Custome folder query. As this will reduce my computation time since all the joins will be done only for the rows with that given request Id rather than for all the rows which is happenning correctly.
Thanks.Hi,
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... -
Pass parameter to Bex Query via Query String
Hello,
I am trying to pass a parameter into a Bex Query from a 7.0 portal. I created a Bex query iView and I have tried various permutations with the Bex Query String property of the iview but nothing seems to work. The query runs but the parameter is not passed in.
For example I have tried: cmd=ldoc&TEMPLATE=Z_TEMPLATE&QUERY=Z_QUERY&Z_QUERY_VARIABLE=12345678 and several other variations of doing this.
Thanks,
BertHi Satish,
I had already tried that but it did not work.
Thanks,
Bert
Maybe you are looking for
-
Oracle 9i installation problem with RedHat 7.2 (segmentation violation)
I have try to installation 9i with RedHat 7.2 by x windows. when i use xwin to run the "./runInstaller, i got the error (segmentation) as below: i have already try to follow the installation procedure in http://staff.in2.hr/denis/oracle/901install_rh
-
I have my Task Bar set to Auto Hide. When I run iTunes it makes the Task Bar always visible. After iTunes is closed the Task Bar is still always visible. I can set the properties of the Task Bar to Auto Hide until I am blue in the face and it won't c
-
How to generate as XML output from Oracle Apps 11
Hi Anyone has the experience to generate the output from Oracle Apps 11 as XML file? Database is 8.1.7, Oracle Apps 11. The concurrent program can be written in PL/SQL or can report 2.5 generate the output as XML? The scenario is: 1) Run a concurrent
-
Hi Experts, We have installed the basic SRM system on Classic Mode. The Bidding Functionality is working fine with Bid Invitation getting published and Bid responce getting created and can be accepted properly. Issue is only when we click on the "Bid
-
Software Inventory and Reporting Services Seems Broken..
Some basic info... Server 2012, SQL 2012, SCCM 2012 R2. All products up to date. Enviornment has been running for about 2 weeks, with all the test clients being brought in a few days after server install. I went to run the report "Computers with a sp