Passing list of values to a function
As what type list of values multiple selections, e.g. resulting in (1,2,3), are represented in function parameters?
for example i have lov that results in (1,2,3) and dataset query is select myfunction(:mylov) from dual.
Variable of what type I must declare in function definition?
when i hadthe same situation , i used cursor query to resolve .
eg.
select myfunction(cursor(select field1 from table1 where field1=:parameter1)) from dual
In the PL sql function get all thee parameters from the cursor variable and pass into the looping statement for furthur processing
Similar Messages
-
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 -
Pass list of values to DB adapter from BPEL process
We want to pass a list of values (length of list and values to be passed will be dynamically determined by the input to this invocation)
How do we pass the input as a list of values to a db adapter where the list of values will form a part of input query where clause.
say eg
select date from tablea where columna in (List1,list2,lsit3) etc
ThanksThis will help you
http://soa-howto.blogspot.com/2009/05/how-to-use-sql-query-having-in-clause.html -
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,
NikoYou 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 -
Can be passed Formula Column value to Procedure/Function?
Below cf_value is return after some calculation by using main query.
Can be directly passed formula column value to procedure without assinged to placeorder?
as below..
f_convert(:cf_value,new_value);
My Procedure is...
PROCEDURE f_convert( val1 in number,val2 in out number) IS
BEGIN
val2 := val1 * 100;
END;
If anyone knows pls reply me....Actually, if there is any other calculations there (In Proceudre)
Can I used is as below??
PROCEDURE f_convert( val1 in number,val2 in out number) IS
BEGIN
val2 := val1 * 100;
return (val2);
END;
----A procedure cannot return a value, the return clause in my previous post was part of the function for formula column.
Suppose you have a formula column say CF_2 then the function for it will be as:
function cf_2formula return number
is
val1 number;
val2 number;
begin
val2 := :cf_1 * 100; -- or val2 := val1 * 100 --parameters not allowed in formula column function
-- All the other code that you need inclusive of calling function, procedure as in any PL/SQL block can be placed
return (val2);
end;So any other calculation can be used in the formula column function -
Pass a particular value in the function module.
Hi Gurus!
I have a function module READ_HAUPTBUCH_TEXT , here in the importing table KONTENPLAN like ska1-ktopl.
But I need to pass a value as ZNOA for KONTENPLAN while calling the function which is maintained in the db, but it is always picking up the value 'AZ'.
can you please let me know as to how i do it .thx in advance.hi sandeep it is better to pass like this...
data: v_ktopl type ska1-ktopl.
clear v_ktopl.
v_ktopl = itab-ktopl.
CALL FUNCTION 'READ_HAUPTBUCH_TEXT'
EXPORTING
kontenplan = v_ktopl
sachkonto =
sprache =
NO_BUFFER =
IMPORTING
TEXT_WA =
EXCEPTIONS
TEXT_NOT_FOUND = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
regards,
venkat. -
Select list display value in javascript function
Hi All,
I have a select list in a tabular form having a display value & return value.
I am using $x(var_name).value or $v(var_name) for retreving return value of the select list in a javascript function.
Can anyone let me know how can I get the display value of the select list in a javascript function? Im using Apex 3.2
Thanks & Regards,
SandeepWhat if the select list is not an item. Select list I am talking about is in a tabular form.Regardless of how they're generated in APEX, in JavaScript they're all DOM nodes. There are many ways of accessing the node of the required element. Consider the Items for Order... tabular form on page 29 of the Sample Application:
var productNameLOV = document.wwv_flow.f04[0] // select list containing name of product on first order line
var productNameLOV = $x("f04_0001") // another way of accessing the same node, using the ID attribute generated by apex_itemWe can see this using the Safari console:
=> productNameLOV = document.wwv_flow.f04[0]
<select name="f04" id="f04_0001" autocomplete="off">…</select>
=> productNameLOV = $x("f04_0001")
<select name="f04" id="f04_0001" autocomplete="off">…</select>Once you've got the node—however you get it—you then use the methods shown above:
=> i = productNameLOV.selectedIndex
3
=> productNameLOV.options.text
"Business Shirt [$50]"
So it appears you would use:var item = document.wwv_flow.f01[i];
var selected = item.selectedIndex;
var selectedOption = item.options[selected].text;
This is meaningless:...
var my_var = document.wwv_flow.f01[i].id; // f01 is tabular column of select list
if ($x(my_var) == 'display_value') //$x(my_var) is having return value, but i need display_value there
<tt>$x(my_var)</tt> returns a DOM node object, whilst <tt>'display_value'</tt> is a string: they are not comparable. -
Can a view pass a restricting value to a function as 'IN' value ?
An existing local view 'email_addresses' that used to just query an underlying, local, simple flat table - needs to be replaced.
IE: The old local view performed a "select username,user,email_address from owner.contacts"
It was called remotely, from within a procedure, over a db_link IE:"select * from from email_addresses@db_linkname where username = 'TOM' "
All was well.
The table of email addresses is now no longer available.
The replacement local view in reality, is to perform an LDAP A.D. query to get the email_address for the supplied username - passed as 'username'
in the 'where clause' - see above Example query.
The code for the AD query uses DBMS_LDAP and gets all atributes for a "sAMAccountName", loops through and keeps just the ones I'm interested in. ( I can supply the code for that too if needed.)
The function or procedure performing the dbms_ldap query could return a concatenated string, or a refcursor - whatever can be made to work with the new view (although a concatenated string would also need to be broken back into 3 columns - maybe using tilde as the field seperators?)
The new view will need to call a function or procedure to return the LDAP data , that itself will accept the limiting 'where' in a ad-hoc query .
The limiting 'where' clause is ALWAYS supplied to the view.
To make it easier for someone to help me , I have supplied the following code.
create table ldap_lookup
(username varchar2(50), name varchar2(50), email_address varchar2(50));
insert into ldap_lookup values('Tom','Thomas','[email protected]');
insert into ldap_lookup values('Dick','Richard','[email protected]');
insert into ldap_lookup values('Bill','William','[email protected]');
commit;
set pagesize 9999
set linesize 200
select * from ldap_lookup;
USERNAME NAME EMAIL_ADDRESS
Tom Thomas [email protected]
Dick Richard [email protected]
Bill William [email protected]
3 rows selected.
SQL> create view v_ldap_lookup as select * from ldap_lookup;
View created.
SQL>
Following is the the query I cannot change.
++++++++++++++++++++++++++++++++++++++++++++
SQL> select * from v_ldap_lookup where username = 'Tom';
USERNAME NAME EMAIL_ADDRESS
Tom Thomas [email protected]
1 row selected.
Great!
Varchar route:
===============
create or replace function f_ldap_lookup (username_in varchar2) return varchar2 as
c_test varchar2(2000);
begin
select username||'~'||name||'~'||EMAIL_ADDRESS into c_test from v_ldap_lookup where upper(USERNAME)=upper(username_in);
return c_test;
end;
select f_ldap_lookup('tom') from dual;
F_LDAP_LOOKUP('TOM')
[email protected]
1 row selected.
create or replace force view v_ldap_lookup_replcement
as
select f_ldap_lookup('username_in')username from dual;
View created.
SQL> select * from v_ldap_lookup_replcement where username = 'Tom';
no rows selected
Refcursor route:
==================
create or replace function f_ldap_lookup_rc (username_in varchar2) return sys_refcursor as
c_test sys_refcursor;
begin
open c_test for select username,name,EMAIL_ADDRESS from v_ldap_lookup where upper(USERNAME)=upper(username_in);
return c_test;
end;
SQL> select F_LDAP_LOOKUP_RC('tom') from dual;
F_LDAP_LOOKUP_RC('TO
CURSOR STATEMENT : 1
CURSOR STATEMENT : 1
USERNAME NAME EMAIL_ADDRESS
Tom Thomas [email protected]
1 row selected.
1 row selected.
SQL> create or replace force view v_ldap_lookup_replcement1
2 as
3 select f_ldap_lookup('username_in')username from dual;
View created.
SQL> select * from v_ldap_lookup_replcement1 where username = 'tom';
no rows selectedIs it POSSIBLE to pass through the new view's limiting 'where' value to the underlying function?
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Or will I have to 'Bite-the-bullet' and modify every remote procedure that called the old view, and change it to perform a remote function call via db-link?vsmith wrote:
Any simple instructions for say:
User does "sqlplus LanLoginName@tnsalias" on their PC (with 10g client tools installed) and it will connect to a Unix DB without any password prompts. Er.. not in our part of the corporate world. SQL*Plus, or MS-Access, or TOAD access to a production database by end-users? That's simply not on.
The DB somehow checks their Lan username from v$process or somewhere against a call to dbms_ldap, and if all's well NOT kill the session? Possible, but not very secure - as that can be spoofed. Not easily (beyond the means of your normal end-user), but you do not need to bind a unique NetBIOS name on that client for the driver to pass that across as part of its connection string. So I'm not sure how comfortable the security people would be with such a solution.
Also, a session cannot kill itself. So it will need to schedule a job or use a DBMS_PIPE or similar to request another process to kill it.
It seems to me that the listener would need to accept the connection attempt and call the dbms_ldap somehow. Maybe that's what OID does. - but only for Kerberos tickets that have been issued from the AD and now passed on from the Client PC.The Listener does not authenticate the Oracle username and password for a session - it is simply there to basically listen for connections and hand these off to dedicated server processes or dispatchers (if shared server is used). So the Listener works on transport level and not application level (e.g. like dealing with encryption of the transport layer).
But then I've never used the Listener with Kerebos/LDAP so I could be wrong here as to the Listener doing authentication....
Yes, a coded application could connect as 'dummy' first, ask from Ldap chacks to be done, set session contexts etc, but what about dumb old sql*plus?In that case, after connecting the same step as the app server needs to be made - a call to the PL/SQL unit that performs the authorisation. Only, without the app layer, there is now no authentication of username and password.
You could built that into PL/SQL too... but then there's the problem with using standard OCI that will result in a clear text username and password being send across the network (as a PL/SQL anonymous block call). Which then requires an encrypted connection between client and server.
This stuff just goes in circles...Yeah.. but I think that is in part that many corporate level security requirements are not realistic and do not meet the actual requirement of securing the network, and most importantly, safeguarding the valid users on it.
Especially if the security is base primarily around Microsoft's concept and implementation of how security should work. That is a recipe for using proprietary stuff that can only seamlessly integrate with other Microsoft products. Microsoft does not only dislike the concept of open standards, they purposefully avoid it, or worse, corrupt it.
Can you give a very quick overview of the NTLM method?Dirty. Not that secure IMO (look for a hacker paper called "+CIFS - Common Insecurities Fail Scrutiny+" by hobbit - old, but in many ways still applicable).
Apache can be build with a NTLM authentication module (just as it supports mod_sso and mod_ldap ) and this allows your app tier (3 tier architecture) to use Apache to do the dirty deed. And that's the extent of how we support NTLM.
Long time ago when still using Oracle v7 on Windows, I recall there was a means to use NTLM authentication with Oracle... no idea how it is supported today and whether or not it requires additional options to be purchased.
Any idea how to duplicate "AD 'Group' accounts of SQL Server" - in Oracle - without buying the Advanced Security Option?Equally long time since I last use SQL-Server.. :-)
I suggest that you consider another forum here on OTN to bounce these questions around. Most members here are here for the SQL and PL/SQL party... security is not exactly an issue that many of us deal with in any extensive way. Thus I doubt that you will get real useful answers here for your problem.. -
How to pass Application Item value in Javascript function.
Hi,
I have the following javascript in the HTML Form Element Attributes properties
I am on Page1 and passing P1_DEPT_NO page item value. This is working perferctly fine and I am able to get the exact value of the page item
onchange="javascript:function1($x('P1_DEPT_NO').value);"I am on Page1 and passing Application Item G_DEPT_NO value.
The problem here is, I am not getting the Application item value inside the javascript function.
I tried using alert(); and it's giving me value as undefined
onchange="javascript:function1($x('G_DEPT_NO').value);"Just want to know, how to pass the Application Item value in Javascript.
Thanks,
DeepakDeepak,
I am not an expert at Javascript, but the suggestin I made was because javascript is a case-sensitive language.. and therefore onChange is not the same as onchange.
Not quite sure if that is causing the problem.
Application items are not associated with a page and therefore have no user interface properties.
Therefore, as mentioned in another post, the rendering would not work for application items.
If it is for a single item, used only in this page, you could create a hidden page item and use it fo your purpose
If you still want to look at application items and AJAX, This page contains examples of using AJAX to solve problems like the one you mentioned.
http://www.oracle.com/technology/obe/hol08/apexweb20/ajax_otn.htm#t1b
Thanks,
Rajesh. -
How to pass multiple filter values in SAPBEXsetFilterValue function
I am using SAPBEXsetFilterValue for filtering the query. I want to have multiple filters for same key value for ex. for plant I want the query to be filtered for two plants at the same time using this function please any one could help me out
Hi,
Afraid, that is not possible:
Re: Setting Multiple Filter Values or Filter Range Using SAPBEX API?
Re: Passing a range to SAPBEX.XLA!SAPBEXSetFilterValue
Re: SAPBEXsetFilterValue
Best regards,
Eugene -
Pass list of values in an array to the IN statement of SELECT in Oracle 10g
Hi,
This is what I have done so far...
I have loaded the main array array_number_1 using BULK Collect. Within the loop I am filtering the data from this array and writing to another array array_number_2.
I want to use the values from array_number_2 in the SELECT statement.
Eg: SELECT sum(x_amount) charges
FROM x_table
WHERE id IN (array_number_2).
Could you provide a solution to this preferrably with an example.
thanksI'm not entirely following you, Visakh, but I have a SQL Task setup in which I have an expression that makes a call to a db2 database such as the abbreviated set example below. The list of IDs in the IN statement must come from another SQL Server
database. In the past I have gotten the list of IDs, put them in a recordset and then put that in a for loop to iterate and make one call to db2 for each and every ID. The single ID example can literally take days to run for 100,000 IDs.
Therefore, I want to pull the entire set of results back at one time via a single (or at least fewer calls than there are IDs) DB2 call using 'in' instead. Maybe I am overlooking something but I don't quite see how your example will get me where
I want to go.
Set Example
SELECT
A,
B
FROM
Table 1,
Table 2,
WHERE
Joins
AND PRSNEUP.ID in ( This is where I want a list of IDs )
Single ID Example
SELECT A,
B
FROM
Table 1, Table 2,
WHERE
Joins AND PRSNEUP.ID = ( VariableContainingASingleID -
How to pass the property value to getter function
In jsp, I have a select box,like this:
<html:select property="chooseType" styleId="chooseType" onchange="javascript:checkType()">
<html:option value="Type1">Type1</html:option>
<html:option value="Type2">Type2</html:option>
<html:option value="Type3">Type3</html:option>
</html:select>
javascript, I use document.getElementById("chooseType").value="Type3";
however, i form.java file, using getChooseType(), I could not get the value "Type3". If I do not set the value by javascript, I just select "Type3" from GUI, value "Type3" is passed properly to the getter.
How to pass the value,set in javascript to getter?
Edited by: [email protected] on Nov 17, 2009 4:23 PMI just found it is caused by the following code.
javascript, I use document.getElementById("chooseType").disabled=true;
So if I disable the select box, the value can not be passed to form. How to disable the select box but still pass the value to form?
Edited by: [email protected] on Nov 17, 2009 11:56 PM -
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;
/ -
Passing parameter values to powershell function from batch file
Hello ,
I haven't used powershell for a while and getting back to using it. I have a function and I want to figure out how to pass the parameter values to the function through batch file.
function Check-FileExists($datafile)
write-host "InputFileName : $datafile"
$datafileExists = Test-Path $datafile
if ($datafileExists)
return 0
else
return -100
<#
$datafile = "C:\Dev\eMetric\PreIDWork\PreIDFiles\SampleInputFile_011.txt"
$returncode = Check-FileExists -datafile $datafile
Write-Host "ReturnCode : $returncode"
$datafile = "C:\Dev\eMetric\PreIDWork\PreIDFiles\SampleInputFile_01.txt"
$returncode = Check-FileExists -datafile $datafile
Write-Host "ReturnCode : $returncode"
#>
The above code seems to be work when I call it. But when I try to call that script and try to pass the parameter values, I am doing something wrong but can't figure out what.
powershell.exe -command " &{"C:\Dev\eMetric\PreIDWork\PowerShell\BulkLoad_Functions.ps1" $returncode = Check-FileExists -datafile "C:\Dev\eMetric\PreIDWork\PreIDFiles\SampleInputFile_01.txt"}"
Write-Host "ReturnCode : $returncode"
$file = "C:\Dev\eMetric\PreIDWork\PreIDFiles\SampleInputFile_01.txt"
powershell.exe -file "C:\Dev\eMetric\PreIDWork\PowerShell\BulkLoad_Functions.ps1" $returncode = Check-FileExists -datafile $datafile
Somehow the I can't get the datafile parameter value being passed to the function. Your help would be much appreciated.
I90RunnerI am not sure about calling a function in a script like how you want to. Also I see you are setting the values of the parameters, this is not needed unless you want default values if nothing is passed. The values for the parameters will be passed via the
batch file. So for me the easiest way is as indicated.
param
[string]$DataFile
function Check-FileExists($datafile)
write-host "InputFileName : $datafile"
$datafileExists = Test-Path $datafile
if ($datafileExists)
return 0
else
return -100
Write-Host "Return Code: $(Check-FileExists $DataFile)"
Then you create a batch file that has
start powershell.exe
-ExecutionPolicy
RemoteSigned -Command
"& {<PathToScript>\MyScript.ps1 -DataFile 'C:\Dev\eMetric\PreIDWork\PreIDFiles\SampleInputFile.txt'}"
Double click the batch file, and it should open a powershell console, load your script and pass it the path specified, which then the script runs it and gives you your output
If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful.
Don't Retire Technet -
Passing SELECT-OPTIONS value to Function Module
Hi,
I need to pass select-options value to a function module.
Code is like the following:
SELECT-OPTIONS seltab FOR object-type.
CALL FUNCTION 'Z_MY_FM'
EXPORTING
sel_tab = seltab
IMPORTING
result_tab = it_result
I have found a similar problem in the SDN forum: How to pass select-options parameter to FM?
However, that could not help me much in solving my problem.
So far I have tried to created a structure in DDIC with the following components for the select-options:
SIGN - BAPISIGN
OPTION - BAPIOPTION
LOW - ZBWOBJECTTYPE (my type)
HIGH - ZBWOBJECTTYPE (my type)
and subsequently a table type for this structure which is specified in the "Import" tab of my function module.
Unfortunately, when I ran the program a runtime exception occured (CALL_FUNCTION_CONFLICT_TYPE).
Could anyone please help me on this issue?
Thanks in advance.
Regards,
Joon MengHello Joon,
CALL FUNCTION 'Z_MY_FM'
EXPORTING
sel_tab = seltab
IMPORTING
result_tab = it_result
You have defined SELTAB as a SELECT-OPTION.
So when you pass only SELTAB, the header line is transferred to the FM. When you pass SELTAB[] the whole table(range) is passed.
It is similar to the concept of an internal table with header line.
Hope i am clear.
Anyways how have you defined result_tab and sel_tab ?
BR,
Suhas
Maybe you are looking for
-
Can't send email from internal server, same domain name as external.
We have a domain "example.com", hosted externally, for email and a website. We are thinking of hosting email 'inhouse' and have setup a dedicated subdomain on a 'fixed' IP, "mini.example.com" for AFP services mainly. mini.example.com provides DNS in
-
HOW TO MAKE THE CONTENT OF THE TABLE PRINT IN A TABLE CONTROL SCREEN?
Can any one tell me how to make the content of the table control print in a table control screen!!? Please help!! I have to make the contents of a table in the table control screen print ? any idea Regards, Vj
-
Ipod Classic - 80GB Rebooting problem
My IPod Classic needs to be rebooted every time it is switched on to get it to work. The software is up to date. Any suggestions?
-
I have an app in my App Store under updates under purchased that I'd like to get removed from my phone. How do I do that?
-
How to add attribute to Item ?
Hi, I have a problem concerning OCS -> Content Service. I try to find out how scaleable the tool is. Do you know is it possible to add attribute to the Item? For example how to add some link to Document in repository? Best regards