SQL Query: How to pass list of values to the IN operator
Hi,
I'm trying to pass a list of values to the WHERE <a> IN <list>
I dont want to use dynamic cursors (REF CURSOR). Is this possible using Oracle SQL?
Please let me know.
My program:
DECLARE
list_of_ids := '10, 20, 30';
SELECT MAX(sal) INTO max_sal FROM employee WHERE emp_id IN (list_of_ids);
END;
Thanks in Advance,
Niko
You do not want to pass a comma separated list. You want to pass a collection. So
CREATE TYPE num_tbl
AS
TABLE OF NUMBER;
DECLARE
l_list_of_ids num_tbl := num_tbl( 10, 20, 30 );
BEGIN
SELECT max(sal)
INTO max_sal
FROM employee
WHERE emp_id IN (SELECT * FROM TABLE( l_list_of_ids ));
END;
/Justin
Similar Messages
-
How to pass line item values in the table paramer of FM
Hi all,
When i will give the import of the FM as VBELN"sales order number.
I want to display all the line items for "PO Quantity in the out put of the FM.
For this i thnk i have to pass the line item values in the table parameter of the FM.
Can any body please tell me how to pass the values for the line items in the table parameter fo teh FM.
Please give a example.
ThanksSub pLoopThroughPivotFields()
Dim oItem As Excel.PivotItem
Dim oField As Excel.PivotField
Set oField = ThisWorkbook.Worksheets("Sheet1").PivotTables("Pivot Table name").PivotFields("field name")
For Each oItem In oField.PivotItems
oField.CurrentPage = oItem.Name
'Put your copy code here
DoEvents
Next oItem
End Sub
Felipe Costa Gualberto - http://www.ambienteoffice.com.br -
How to pass wild card '%' value from the parameter to the query
Hello everyone,
I have following 2 problems
1) I was trying to do some thing like below
select * from emp
where ename like 'J%'
for this i have used the following code
select * from emp
where ename like :P_ENAME
and before running the query in the parameter box i entered J%. But my report returns an error which says INVALID PARAMETERS REQUESTED.
2) I have a req of passing both comma separated and wild card for the same parameter. If we take the same example as above,
user should be able to enter
a) JASON, SMITH, JOHN OR b) J%
I have used comma separated value option of the parameter for the csv values and its working fine, but i need to add the wild card feature also to the same parameter.
Can anyone please help me with these things?????
Thanks in advance!!
RaghuHi Raghu,
I guess you are in older version, You have to get into latest version to use %, it should work well
you should use where ( ename like :P_ENAME ) or ( ename in (:P_ENAME)) for both the condition to satisfy. -
How to pass list of values to REF CURSOR?
Hi there,
I have a package for ref cursor return as following:
<pre>
create or replace package p_mypkg as
type t_ref_cur is REF CURSOR;
function f_t_refcur (strsql varchar2) return t_ref_cur;
end;
create or replace package body p_mypkg as
function f_t_refcur(strsql varchar2) return t_ref_cur as
cur t_ref_cur;
sql_stmt varchar2(1000);
begin
sql_stmt:='select object_name,object_type from user_objects where object_type in (:j)';
open cur for sql_stmt using strsql;
return cur;
end;
end;
var results refcursor
begin
:results:=p_mypkg.f_t_refcur('TABLE');
end;
print results
var results refcursor
begin
:results:=p_mypkg.f_t_refcur('INDEX');
end;
print results
I got the result sets using just one value.
But I got nothing when use two values as input.
Any idea?
var results refcursor
begin
:results:=p_mypkg.f_t_refcur('''TABLE'',''INDEX''');
end;
print results
SQL>
no rows selected
Thanks,
SZYou can also use ...from table(... :
create or replace type numbertype
as object
(nr number(20,10) )
create or replace type number_table
as table of numbertype
create or replace procedure tableselect
( p_numbers in number_table
, p_ref_result out sys_refcursor)
is
begin
open p_ref_result for
select *
from employees , (select /*+ cardinality(tab 10) */ tab.nr from table(p_numbers) tab) tbnrs
where id = tbnrs.nr;
end;
/ -
How to pass session variable value with GO URL to override session value
Hi Gurus,
We have below requirement.Please help us at the earliest.
How to pass session variable value with GO URL to override session value. ( It is not working after making changes to authentication xml file session init block creation as explained by oracle (Bug No14372679 : which they claim it is fixed in 1.7 version Ref No :Bug 14372679 : REQUEST VARIABLE NOT OVERRIDING SESSION VARIABLE RUNNING THRU A GO URL )
Please provide step by step solution.No vague answers.
I followed below steps mentioned.
RPD:
****-> Created a session variable called STATUS
-> Create Session Init block called Init_Status with SQL
select 'ACTIVE' from dual;
-> Assigned the session variable STATUS to Init block Init_Status
authenticationschemas.xml:
Added
<RequestVariable source="url" type="informational"
nameInSource="RE_CODE" biVariableName="NQ_SESSION.STATUS"/>
Report
Edit column "Contract Status" and added session variable as
VALUEOF(NQ_SESSION.STATUS)
URL:
http://localhost:9704/analytics/saw.dll?PortalGo&Action=prompt&path=%2Fshared%2FQAV%2FTest_Report_By%20Contract%20Status&RE_CODE='EXPIRED'
Issue:
When I run the URL above with parameter EXPIRED, the report still shows for ACTIVE only. The URL is not making any difference with report.
Report is picking the default value from RPD session variable init query.
could you please let me know if I am missing something.Hi,
Check those links might help you.
Integrating Oracle OBIEE Content using GO URL
How to set session variables using url variables | OBIEE Blog
OBIEE 10G - How to set a request/session variable using the Saw Url (Go/Dashboard) | GerardNico.com (BI, OBIEE, O…
Thanks,
Satya -
Passing list of values as a parameter to repot through form
hi,
i am trying to passing parameters to report through form by
using ADD_PARAMETER_LIST and RUN_PRODUCT .but i am not able to
pass list of values to report.For example if use select state_id
from the list box,it has to give all details of that state
report.how to do this?
please help me.
thanks in adv
rao
nullrao (guest) wrote:
: hi,
: i am trying to passing parameters to report through form by
: using ADD_PARAMETER_LIST and RUN_PRODUCT .but i am not able
to
: pass list of values to report.For example if use select
state_id
: from the list box,it has to give all details of that state
: report.how to do this?
: please help me.
: thanks in adv
: rao
there are at least two path to do that:
1. for each detail item mak a parameter in reports and add it to
paramlist
2. pass only stade_id as parameter and in reports query other
details
hope this helps
null -
How to implement list of values with bind parameters
Hi All,
Please give me details about how to implement list of values with bind parameters.
I have implemented with below things.
1) created lov view object with query like select meaning, lookup_code from fnd_lookup_values where lookup_type=:1;
2) The above vo added to applicationa module.
3) created Controller class in the co class written code in processRequest();
String vLookupType=pageContext.getParameter("LookupType");
Serializable params={vLookupType};
am.invokemethod("Initialize",params);
4) In AM Impl Class invoke the VO
5) In VO Impl class executed the query..
But the above process working fine but when i give the value in lov text field like 'C' then press tab button the result will not showing instead of that i am getting error message, i want to implement standard lov functionality while implementing query with bind parameter.
any thing reqired to add the code to controller for search criteria..
Thanks
MatetiHi
i am getting error as
oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: SELECT * FROM (SELECT meaning, lookup_code,lookup_type
FROM fnd_lookup_values
WHERE view_application_id = 200) QRSLT WHERE (lookup_type=:1 AND ( UPPER(MEANING) like :2 AND (MEANING like :3 OR MEANING like :4 OR MEANING like :5 OR MEANING like :6)))
Thanks
Mateti -
SQL query to get a list of relations between workitems
How can I create a SQL query to get a list of all problems with related changes? And all problems with related incidents?
I have tried to join the tables RelationshipTypeDim with ProblemDimKey and ChangeRequestDim, but the results are not correct.The relationships in the data warehouse can be kind of tricky. The relationships are contained in the WorkItemRelatesToWorkItemFactvw table. This table lists the related items by their WorkItemDimKey, so you cannot reference directly from the ChangeRequestDimvw
or ProblemDimvw. You will need to reference the WorkItemDimvw to get the WorkItemDimKey for each entry.
The query below will get all of the related work items from the Change Request class. The way the joins work is ChangeRequestDimvw gets the list of change requests. Then inner joins WorkItemDimvw to get the WorkItemDimKey for each CR. Then inner joins WorkItemRelatesToWorkItemFactvw
to get all of the CRs with related work items. Then inner joins the WorkItemDimvw again to get the ID of the related work item.
Now the tricky part is it appears that these relationship are set based on which item that created the relationship. So you need to union a second query that reverse the relationship on the WorkItemRelatesToWorkItemFactvw.
This query should give you a good start on getting the related work items. You can filter it down from here if you only want to include problems.
SELECT C.ID, WIWI.ID
FROM dbo.ChangeRequestDimvw C
INNER JOIN dbo.WorkItemDimvw WI ON
WI.EntityDimKey = C.EntityDimKey
INNER JOIN dbo.WorkItemRelatesToWorkItemFactvw AS WIRWI ON
WIRWI.WorkItemDimKey = WI.WorkItemDimKey
INNER JOIN dbo.WorkItemDimvw AS WIWI ON
WIWI.WorkItemDimKey = WIRWI.WorkItemRelatesToWorkItem_WorkItemDimKey
union
SELECT C.ID, WIWI.ID
FROM dbo.ChangeRequestDimvw C
INNER JOIN dbo.WorkItemDimvw WI ON
WI.EntityDimKey = C.EntityDimKey
INNER JOIN dbo.WorkItemRelatesToWorkItemFactvw AS WIRWI ON
WIRWI.WorkItemRelatesToWorkItem_WorkItemDimKey = WI.WorkItemDimKey
INNER JOIN dbo.WorkItemDimvw AS WIWI ON
WIWI.WorkItemDimKey = WIRWI.WorkItemDimKey
Order by C.ID
Matthew Dowst |
Blog | Twitter -
Join query in a dynamic list of values query
I have a join query in a dynamic list of values query. The value does not return a text value, but rather the id value.
Is it possible to use a join query in a dynamic list of values query?
For example...in the below query, I expect to see ename in the drop down list, but I see class_emp_id.
select b.ename d, a.class_emp_id r
from class_emp a, emp b
where a.class_cat_id = :CURR_CLASS_CAT_ID
and a.emp_id = b.emp_id
order by 1
Thanks,
Reid:CURR_CLASS_CAT_ID is a number datatype.
I think the problem is with the ARF. Whenever I change the dynamic LOV query to exclude the :CURR_CLASS_CAT_ID (a passed in session variable), the drop down shows all the text names I am looking for; albeit, too many since I am excluding the :CURR_CLASS_CAT_ID.
The page I am having the problem with is a popup that is called from a report link on another page. When I show the session variables on the popup page, it shows values for only 1 of the 3 session variables I am passing to this page.
I am using the javascript:popUp2 syntax when I call the popup page from the report link.
As I said previously, I am passing 3 parms and only the 1st parm is getting a value. Yes, there are values for all three parms in the record of the report.
Is there a limit to the number of variables (itemNames) that can be passed to the popup using this method? -
How to pass a default value in selection screen of logical database pnpce
Dear All,
Can any one tell me how to pass a default value in selection screen of logical database pnpce .
Regards
Rakesh SinghHi Rakesh,
Go to SE36 (logical database Builder).First enter PNPCE in Logical Database and press documentation,here you will get the details of exactly what is PNPCE and how it works.After that select selections in subojects in se36 only and enter display ,there you have the include from where you acn get the idea.
Regards,
Rahul -
How to Pass a HEX-Value to AdobeLifeCycle (TA:SFP) .
Hello all,
how to pass a HEX-Value to print a BLACK RIGHT-POINTING TRIANGLE?
I want to pass a HEX value to AdobeLifeCycle (TA:SFP).
This is done as follwoing:
*-- Variablen
DATA hex(2) TYPE x.
SET BIT: 01 OF hex TO 0,
02 OF hex TO 0,
03 OF hex TO 1,
04 OF hex TO 0,
05 OF hex TO 0,
06 OF hex TO 1,
07 OF hex TO 0,
08 OF hex TO 1,
09 OF hex TO 1,
10 OF hex TO 0,
11 OF hex TO 1,
12 OF hex TO 1,
13 OF hex TO 1,
14 OF hex TO 0,
15 OF hex TO 1,
16 OF hex TO 0.
The HEX-VALUE ist u201E25BAu201C from the codepage 4110 = BLACK RIGHT-POINTING TRIANGLE, (use TA:SPC to see it).
I set the HEX-VALUE before i call the PDF-OUTPUT:
move hex to ls_frmglobal-hex. u201E(the field ist defined as u201ERAWSTRINGu201C)
Then i call the Output;
Now call the generated function module
CALL FUNCTION fm_name
EXPORTING
/1bcdwb/docparams = fp_docparams
frmglobal = ls_frmglobal
frmisu = ls_frmisu
frminf = ls_frminf
connections = connections
t_sums = t_sums
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.
The result is u201E25BAu2018 instead of the BLACK RIGHT-POINTING TRIANGLE.
Can any one have a idea what is goning wrong?
I know how to print a Triangle on the Designer the quetion is how to pass the Hex-Value from a different codepage than the Stanndard codepage which we use.
Thanks and regards
IbrahimI am trying to match \xfa which means that match faas
a hex value.
All I want to know is how to use the RE class tocheck
for a cetain hex value.
Correction:
If the data is numeric, it can be matched using a hex,
or octal representation for the regular
expression. for instance, the numeric value 6 will be
matched with either of the following regexes (hex,
and octal, respectively). Read the API for
the Pattern class if this doesn't make sense.
"\06"
"\006"(Should have checked first...) -
How to pass this multi-value parameter via GoURL?
Currency is equal to / is in 'USD', 'GBR', 'RUR'. How to pass such multi-value parameter via GoURL?
P0=1&P1=eq&P2=Measures.Currency&P3=?Found. P0=1&P1=eq&P2=Measures.Currency&P3=3+USD+GBR+RUR
-
How to pass apex item value into custom xml for chart or guage?
Re-opening the old thread : Re: How to pass apex item value into custom xml for chart or guage?
Which was not answered.
Roel - Thanks. Its working - but in a semi quotes in the custom XML
<pointers>
<pointer value= '&P5_RUNNING_TOTAL.'
<label enabled="true">
<position placement_mode="ByPoint" x="50" y="15" />
<format>{%Value}{numDecimals:1}</format>
<background enabled="false" />
</label>
</pointer>
</pointers>This question was helpful for us to resolving one recent thread : AnyChart - set Dial axis intervals dynamically?
(Re: AnyChart - set Dial axis intervals dynamically?
Edited by: P.Ranish on Dec 13, 2012 6:23 AMP.Ranish wrote:
Is there any update for this question ???
Edited by: P.Ranish on Dec 13, 2012 3:36 AMNo, And there won't be in the future.
Please stop posting followup's to old threads, if you have a real problem please search the forum first and post a new question with all information
Roel wrote:
Try using &P5_RUNNING_TOTAL. or #P5_RUNNING_TOTAL#Just to make it clear - this will only work if page is reloaded after setting the item values dynamically via AJAX -
How to pass a variable value into a custom planning function via a web
Can some one tell me
How to pass a variable value into a custom planning function via a web template?
What are the different types of Planning function parameters available and what is the difference between them?
Thanks
babuHi Sutrtha,
Yeah I got the pop up asking to select the variables used, I have selected ENTITY_ID that was used by the interfaces, but on execution of the package the Scenario did not work as the passeed variable #ENTITY_ID is set to 0 instead of the value I am passing.
Am I missing something?
Regards
B -
How to pass internal table values to parameter
hi,
how to pass internal table values to parameter in selection screen.if is it possible means please sent codeings.
thanks.
stalin.hi,
tables : mara.
data : begin of itab_mara occurs 0,
matnr like mara-matnr,
ernam like mara-ernam,
end of itab_mara.
selection-screen : begin of block blk1 with frame title text-001.
parameters : p_matnr like mara-matnr.
selection-screen : end of block blk1.
select matnr ernam from mara into corresponding fields of itab_mara
where matnr = p_matnr.
loop at itab_mara.
write :/ itab_mara-matnr,
itab_mara-ernam.
endloop.
<b><REMOVED BY MODERATOR></b>
Message was edited by:
Alvaro Tejada Galindo
Maybe you are looking for
-
Movies will play on my ipod but there is no sound
After downloading movies to my computer I can play them in quicktime player. I can download them to itunes, but when I put them on my ipod after converting them the sound doesn't play. I figured that the sound doesn't play because it says its "muxed"
-
Question reg. how to get a field from a table
What is EIN? (I think it is employer identification number). My functional consultant told me to get this value from company code. Can you tell me from which table and field I can get this value? Thanks, Krishen
-
Is this a valid work around for disabled TextField Font colors?
We would like to change the font color in disabled TextFields. Since the AWT calls some native code that apparently overrides any call to setForeground(), so that the Foreground is always a light gray color in disabled TextFields I decided to overrid
-
Hi There, I'm using zend framework for doing the app which I developed on Mac but had to switch back to Windows 7. I tried to move the application as far as I can, but I'm not able to solve one big problem. This situation is as follow: -> I login wit
-
I copied my iTunes library from another computer, but apparently something failed in the process, because not all of the files got copied onto my external HD. Perhaps I tried to copy too many files at once. In any case, I know have a lot of files not