Crystal report query to Oracle with Allow multi value parameter - oracle

I use Crystal report 2011 to create report from with data from Oracle database. I have a Allow multi values parameter name userid (userid is string).
I want to query
Select ... from table where userid in {?userid};
I try {?userid}, ({?userid}), '{?userid}' ... but it's not working.
what should I do?

Put the cursor on the place where you want it, and double click on the parameter.

Related

How to append a string to where clause in APEX Interactive Report SQL

I am a newbee in Apex and I am using apex 5.1.3. I am creating a report through sql query and where clause of the query should be dynamic which needs be taken from another table column. On page load i loaded this where condition string from table and set that as page item :P5_NEW
I tried like this:
select * from EMPLOYEES where :P5_NEW
Page item :P5_NEW contains the string which should be appended to where clause. But apex throws error ORA-00920: invalid relational operator.
Can some one please advice how I can append a string to where clause in APEX report query?
Thanks
P5_NEW (well, why not P5_WHERE?) should be a Text field with "Submit when Enter pressed" set to YES. It should contain the whole WHERE clause, including the WHERE keyword. If you put it as you did, you'll get the ORA-00936 missing expression error.
Query would then look like this:
select *
from employees
&P5_WHERE. --> pay attention! Ampersand (&) followed by field name
--> followed by a dot (.)
What next? Nothing ... run the page & enjoy. If you enter something like
WHERE department_id = 10 into the P5_WHERE field and hit Enter key, output should change.

How do I use a parameter within BI Publisher to update the table name I am querying in an Oracle Data set

I am trying to create a BI Publisher data model which runs the Oracle query below -
SELECT *
FROM audit_YYYYMM
(this should be the YYYYMM of the current date)
How do I setup a parameter default value within the datamodel to grab the YYYYMM from the SYSDATE?
How do I append this parameter within the data set SQL Query?
I tried SELECT * FROM audit_:Month_YYYYMM
(where I had a string parameter called Month_YYYMM)
This did not work.
You are going to have to use something like EXECUTE_IMMEDIATE. And you may have to make a separate PL/SQL package to launch rather than use the built in data definition stuff.
https://docs.oracle.com/cd/B19306_01/appdev.102/b14261/executeimmediate_statement.htm

SQL statement at Birt Report for parameters

Currently I'm using Birt Report to generate report from my system. I'm using input parameter to send parameter from my system to Birt Report. The problem is when I'm trying to send multiple parameter from my system.
SQL statement at Birt Report for one parameter
select actualdate from table1 where storeloc = ?;
When I use this query for one parameter, it work.
I tried sql like this
select actualdate from table1 where storeloc = params["storeloc"].value;
I already created parameter at data set and report parameter but it's still can't gets to work
and also birt dont show me the options in edit dataset for query and Linked To Report Parameters in parameters
so what should i do?
Create a parameter storeloc in report params section of Data source.
Write this query in dataset open:
select actualdate from table1 where storeloc='"+params["storeloc"]+"';
Fetch the actualdate value in data source fetch and run the report.

Oracle Forms 6i Resolve LOV code

I have a LOV with two columns one is code and the other is description. I know that text items have a property which says validate from list however my code field and description field are display items. We do not want to force the user to click on a button to show the LOV. In the pre-form trigger i am setting a default value in the code field.
I would like to get/resolve the code to its description from the list without having to do a select from the database. Does anyone know of a way to get this done?
I have had also this very same problem. There might not be a solution to retrieve the label column from record group in the runtime.
But you could do this:
Store the record group query somewhere (package header or DB column).
Populate your record group with query in the runtime.
Create DB function which takes query and key value as parameters. The function would then return description of the key value (use dynamic SQL, execute immediate / dbms_sql).
Use the function in the POST-QUERY trigger:
:block.item_description := your_new_function(l_query, :block.item_value);

Set query FROM table using report parameter in BIRT

I am using the BIRT report writer, and I have multiple tables with the same data structure. In my report design, I want to select the table my query uses as a report parameter (as part of a mysql query in the data set) -- but I can't figure it out.
When I create the data set, it's great that I can use parameters in the form of SELECT * FROM WHERE ?, and set these to report parameters, but I get an error if I set the ? to the table, such as:
SELECT * FROM ? WHERE 1
Is there another way I can do this? As it's java, I assume the syntax follows that of a PreparedStatement. In BIRT 2.5 there is a property binding option under the data set dialog... and I've tried setting my query as: "SELECT * FROM "+params["DataTable"].value+" WHERE 1", but that was also results in an error.
I just answered this same question over at BIRT Exchange: http://www.birt-exchange.org/forum/designing-birt-reports/19097-set-query-table-using-report-parameter.html#post62590
I should note that the queries MUST return the same fields & data types after you modify them. I only note this because of your statement above that the table structure varies "a bit". It is perfectly safe to modify the FROM or WHERE clauses in a BIRT query, but you cannot modify the actual SELECT construct.

Resources