How can I pass Recordsets as input parameter to a Function ?

Hi Gurus,
I want to create a function that receive recordsets as input parameter also returns recordsets as output.
I have a requirement to do stock taking for all order items of one Order number in one single query execution (to avoid row by row basis).
From the post in the forum I know that a function can return recordsets / query result using REF CURSOR or pipelined table function.
My question is : how to pass the recordsets as input parameter to that function ?
(because I could have 75 rows item in one order number)
Below is the DDL and the query :
create table stocks (Product char(4), Warehouse char(5), expireddate date, qty_available number)
insert into stocks values('P001', 'WH001', '01-dec-2006', 30)
insert into stocks values('P001', 'WH002', '01-dec-2006', 50)
insert into stocks values('P001', 'WH002', '01-jan-2007', 50 )
insert into stocks values('P001', 'WH001', '01-Mar-2007', 150)
insert into stocks values('P002', 'WH003', '01-dec-2006', 25)
insert into stocks values('P002', 'WH003', '15-Jan-2007', 50)
insert into stocks values('P002', 'WH003', '01-Mar-2007', 75)
insert into stocks values('P003', 'WH001', '01-dec-2006', 30)
insert into stocks values('P003', 'WH002', '15-Jan-2007', 40)
insert into stocks values('P003', 'WH003', '01-Mar-2007', 50)
CREATE TABLE Order_Detail (PRODUCT_ORD CHAR(4), QTY_ORD number, Priority_WH CHAR(5) )
INSERT INTO Order_Detail VALUES ('P001', 75, 'WH003') // previously 'WH002'
INSERT INTO Order_Detail VALUES ('P002', 45, 'WH002')
INSERT INTO Order_Detail VALUES ('P003', 55, NULL)
The query for stock taking :
select product,warehouse,expireddate, least(qty_available-(sm - qty_ord),qty_available) qty
from ( select product,warehouse,expireddate,qty_available,qty_ord, sum(qty_available) over(partition by product order by s.product,expireddate,decode(warehouse,priority_wh,0,1),warehouse ) sm
from stocks s,order_detail o
where s.product = o.product_ord order by s.product,expireddate,decode(warehouse,priority_wh,0,1) )
where (sm - qty_ord) < qty_available

Hi,
This my requirement :
I have (simplified)Order_Detail as below :
CREATE TABLE Order_Detail (PRODUCT_ORD CHAR(4), QTY_ORD number, Priority_WH CHAR(5) )
INSERT INTO Order_Detail VALUES ('P001', 75, 'WH003') // previously 'WH002'
INSERT INTO Order_Detail VALUES ('P002', 45, 'WH002')
INSERT INTO Order_Detail VALUES ('P003', 55, NULL)
Then I want to do stock taking from my STOCK table (described on my first post on this thread)
create table stocks (Product char(4), Warehouse char(5), expireddate date, qty_available number)
The rule is : The stok taking is on First In First Out basis, on expireddate.
And I want to do it in single query.
I want to make this a Function / Stored Procedure so that other transaction can also make use of this query.
That is why I need to pass the 3 rows oy mr Order_Detail above, do the query, and return the result.
Then INSERT the result into ORDER_DETAIL_PER_EXPIRED_DATE table.
I hope this clear my requirement, is this possible ?
Thank you,
xtanto

Similar Messages

  • How can I pass a path to the FileReference upload function?

    i don't understand how can i upload a file from the browse
    function after you've selected a file. since FileReference.name
    returns
    only the filename w/extension and not the path, how can i
    work around this?
    i understand the security implications with a swf and the
    such, but what to do? and using an AIR app is not an option for me.
    i have a .net web service in place and it works with a hard
    coded string, such as in the snippet below, but how are people
    doing this by using the browse method as oppossed to a static
    string?
    i get an IO error with just the browse() returned filename,
    which makes sense when you think about it. path, path, path...ARGH!
    thanks folks...
    -fd

    i don't understand how can i upload a file from the browse
    function after you've selected a file. since FileReference.name
    returns
    only the filename w/extension and not the path, how can i
    work around this?
    i understand the security implications with a swf and the
    such, but what to do? and using an AIR app is not an option for me.
    i have a .net web service in place and it works with a hard
    coded string, such as in the snippet below, but how are people
    doing this by using the browse method as oppossed to a static
    string?
    i get an IO error with just the browse() returned filename,
    which makes sense when you think about it. path, path, path...ARGH!
    thanks folks...
    -fd

  • How can I set object as a parameter of one function

    I want to pass a object as one of the parameters so that I can execute the function of the object in another class. Urgent and thanks a lot.

    What is stopping you from just doing that?

  • How can I pass dynamic value as a user input parameter in discoverer?

    Hi,
    I have a requirement for a discoverer report like this: The report will display only details for Suppliers that have expired (or soon to be) Insurance details. That is the Expiration Date is less than or equal to the day the report is being run plus any days specified in the Number of Days in the Future Parameter.
    The sample code as:
    SELECT s.segment1 vendor_number
    ,s.vendor_name
    ,flv1.meaning classification
    ,pca.certificate_number
    ,pca.certifying_agency
    ,pca.expiration_date
    ,flv2.meaning status
    FROM ap_suppliers s
    ,pos_bus_class_attr pca
    ,fnd_lookup_values flv1
    ,fnd_lookup_values flv2
    WHERE pca.vendor_id = s.vendor_id
    AND flv1.lookup_code = pca.lookup_code
    AND flv1.lookup_type = pca.lookup_type
    AND flv2.lookup_code = pca.class_status
    AND flv2.lookup_type = 'POS_BUS_CLASS_STATUSES'
    AND pca.expiration_date <= trunc(sysdate) + <No. of Days in the Future>
    order by pca.expiration_date asc
    Now the parameter is Number of Days in the Future (Enter the number days in the future to extract the data. This will default to 0).
    Is it possible in discoverer to do so as in query i do that like a condition as pca.expiration_date <= trunc(sysdate) + <No. of Days in the Future>.
    How can I pass <No. of Days in the Future> as a user input parameter in discoverer?
    Please help.

    Hi,
    All you need to do is to create the condition in the discoverer instead of in the query.
    Create a custom folder containing the following sq (note that i removed the condition)l:
    SELECT s.segment1 vendor_number
    ,s.vendor_name
    ,flv1.meaning classification
    ,pca.certificate_number
    ,pca.certifying_agency
    ,pca.expiration_date
    ,flv2.meaning status
    FROM ap_suppliers s
    ,pos_bus_class_attr pca
    ,fnd_lookup_values flv1
    ,fnd_lookup_values flv2
    WHERE pca.vendor_id = s.vendor_id
    AND flv1.lookup_code = pca.lookup_code
    AND flv1.lookup_type = pca.lookup_type
    AND flv2.lookup_code = pca.class_status
    AND flv2.lookup_type = 'POS_BUS_CLASS_STATUSES'
    Then create a discoverer report using this folder using all fields.
    Create a new calculation as (use this exact syntax):
    Sysdate + :No_of_Days_in_the_Future
    Create a new condition:
    pca.expiration_date <= <your calculation>
    To complete it add a sort as you did in the SQL.
    That's it.
    Tamir

  • How can I pass empty value in URL Parameter

    Hi,
    I am passing different URL parameters to one page, to filter
    the recordset on that page. How can I pass an empty value in the
    URL parameter so that the recordset in unfiltered?
    The URL parameter is based on one field of the database:
    ContentType. So, the link would be to
    default.asp?ContentType=Event
    and then all records that have the ContentType field in the
    DB as Event are displayed. Is it possible to use this system to
    pass an empty parameter so that all records are displayed?
    Thanks
    Ian

    ?ContentType=All
    <% if (ContentType == "All")
    Build recordset w/o filtering
    ASP is rusty, but those are the basics.
    "iandobie" <[email protected]> wrote in
    message
    news:e8im80$q7m$[email protected]..
    > Hi,
    > I am passing different URL parameters to one page, to
    filter the recordset
    > on
    > that page. How can I pass an empty value in the URL
    parameter so that the
    > recordset in unfiltered?
    > The URL parameter is based on one field of the database:
    ContentType. So,
    > the
    > link would be to
    > default.asp?ContentType=Event
    > and then all records that have the ContentType field in
    the DB as Event
    > are
    > displayed. Is it possible to use this system to pass an
    empty parameter so
    > that
    > all records are displayed?
    > Thanks
    > Ian
    >

  • How can i pass the  parameter for strored procedure from java

    dear all,
    I am very new for stored procedure
    1. I want to write the strored procedure for insert.
    2. How can i pass the parameter for that procedure from java.
    if any material available in internet create procedure and call procedure from java , and passing parameter to procedure from java

    Hi Ram,
    To call the callable statement use the below sample.
    stmt = conn.prepareCall("{call <procedure name>(?,?)}");
    stmt.setString(1,value);//Input parameter
    stmt.registerOutParameter(2,Types.BIGINT);//Output parameter
    stmt.execute();
    seq = (int)stmt.getLong(2);//Getting the result from the procedure.

  • How can I pass an empty array to a parameter of type PLSQLAssociativeArray

    How can I pass an empty array to a parameter of type PLSQLAssociativeArray in VB? I defined the parameter like this
    Dim myArray() as String = new String() {}
    Dim myPara as new Oracle.DataAccess.Client.OracleCollectionType.PLSQLAssociativeArray
    myPara = 0
    myPara.Value = myArray
    When I execute my stored procedure giving the above parameter, I got error saying OracleParameter.Value is invalid.
    I have tried to give it the DBNull.Value, but it doesn't work either.
    Note: everything works fine as long as myArray has some item in there. I just wonder how I can make it works in case I have nothing.
    Thank you,

    How can I pass an empty array to a parameter of type PLSQLAssociativeArray in VB? I defined the parameter like this
    Dim myArray() as String = new String() {}
    Dim myPara as new Oracle.DataAccess.Client.OracleCollectionType.PLSQLAssociativeArray
    myPara = 0
    myPara.Value = myArray
    When I execute my stored procedure giving the above parameter, I got error saying OracleParameter.Value is invalid.
    I have tried to give it the DBNull.Value, but it doesn't work either.
    Note: everything works fine as long as myArray has some item in there. I just wonder how I can make it works in case I have nothing.
    Thank you,

  • How can i pass the Input value to the sql file in the korn shell ??

    Hi,
    How can i pass the Input value to the sql file in the korn shell ??
    I have to pass the 4 different values to the sql file and each time i pass the value it has to generate the txt file for that value like wise it has to generate the 4 files at each run.
    can any one help me out.
    Raja

    Can you please more elaberate., perhaps you should more elaberate.
    sqlplus is a program. you start it from the korn shell. when it's finished, processing control returns to the korn shell. the korn shell and sqlplus do not communicate back and forth.
    so "spool the output from .sql file to some txt file from k shell, while passing the input parameters to the sql file from korn shell" makes no sense.

  • How can i pass a parameter to the query to filter the result of this lookup

    Hello,
    i'm developping a web application with JDeveloper 10.1.2 and JHeadStart.
    i realy need to know how can i filter the lookup (LOV) query result.
    in other word, when i click on the lookup, it show all the row that exist in may data base table.
    what i want is how can i pass a parameter to the query to filter the result of this lookup ?
    Thank you

    Hi,
    have a look if this helps
    http://oracle.com/technology/products/jdev/tips/fnimphius/restrictlovlist/restrictlov.html
    Frank

  • How can I pass a BLOB parameter 32K from VB to a stored procedure?

    I am using Visual Basic 6 and the Oracle database 10g to call stored procedures. I am passing a XML input parameter to this stored proc. This variable has been defined as BLOB in stored proc and as XMLType in the table to which it finally gets stored through procedure.
    But there seems to be a limit to the size of a parameter you can pass in. This seems to be 32K!!! It works fine as long as my input is < 32k but once it becomes > 32k, Oracle gives the following error:-
    "ORA-01460: unimplemented or unreasonable conversion requested"
    I searched on net and found lots of examples for a workaround with .Net (using OracleLob). For Vb6, the only examples I found were using AppendChunk method etc through a loop, where each call will insert 32k chunk. But, that would mean lots of calls to stored proc, as we need to do this for thousands of files and each file of size > 100k.. So, this method would not be acceptable.
    Can someone please help me with this.

    Mofizur,
    You can achieve the same using Session variable.
    If u are not executing the VO after PR. Then you will be able to get the same value as u are using in PR
    String transactionId = (String) vo_trans.first().getAttribute("Getnexttrans");
    Note - You have a few of the threads left open, mark it as answered if solved.
    Regards,
    Gyan

  • How can I pass parameter from report to form?

    Hi :)
    Now I try to build conference room like this by using form
    and report. And i design that when users click at group report
    then i'll show page that contain questions report and add
    question form. And question form and report must receive the
    same parameter from group report.
    First Problem: is I don't know how group report send the
    same parameter to question report and add question report at the
    same time. And is it possible??? If not please suggest me what
    should I do???
    Second Problem: is I don't know how can I pass parameter from
    report to form. I don't know the way to do it.
    Please tell me!!! Please...
    I look forward to hearing from all of you.
    Thank You.

    One way is to create a link based on that form and attach that
    link with the report. Through links you can pass parameters

  • How can I pass a value to the command prompt?

    I was wondering how can I pass a value to the command prompt with Windows and Linux? I'm more interested in Linux's system than Windows though. Is there a way to return info from the command prompt?

    Here is a snippet from http://mindprod.com/jglossexec.html that explains how in detail.
    Runtime.getRuntime().exec("myprog.exe") will spawn an external process that runs in parallel with the Java execution. In Windows 95/98/ME/NT/2000/XP, you must use an explicit *.exe or *.com extension on the parameter. It is also best to fully qualify those names so that the system executable search path is irrelevant, and so you don't pick up some stray program off the path with the same name.
    To run a *.BAT, *.CMD, *.html *.BTM or URL you must invoke the command processor with these as a parameter. These extensions are not first class executables in Windows. They are input data for the command processor. You must also invoke the command processor when you want to use the < > | piping options, Here's how, presuming you are not interested in looking at the output:
    Runtime.getRuntime( ).exec ("command.com /E:1900 /C MyBat.bat" );
    Runtime.getRuntime( ).exec ("cmd.exe /E:1900 /C MyCmd.cmd" );
    Runtime.getRuntime( ).exec ("C:\\4DOS601\\4DOS.COM /E:1900 /C MyBtm.btm" );
    Runtime.getRuntime( ).exec ("D:\\4NT301\\4NT.EXE /E:1900 /C MyBtm.btm" );
    There are also overloaded forms of exec(),
    Runtime.getRuntime( ).exec ("command.com /E:1900 /C MyBat.bat", null);
    Runtime.getRuntime( ).exec ("command.com /E:1900 /C MyBat.bat", null, "C:\\SomeDirectory");
    The second argument can be a String [], and can be used to set environment variables. In the second case, "C:\\SomeDirectory" specifies a directory for the process to start in. If, for instance, your process saves files to disk, then this form allows you to specify which directory they will be saved in.
    Windows and NT will let you feed a URL string to the command processor and it will find a browser, launch the browser, and render the page, e.g.
    Runtime.getRuntime( ).exec ("command.com http://mindprod.com/projects.html" );
    Another lower level approach that does not require extension associations to be quite as well set up is:
    Runtime.getRuntime( ).exec ("rundll32 url.dll,FileProtocolHandler http://mindprod.com/projects.html" );
    Note that a URL is not the same thing as a file name. You can point your browser at a local file with something like this: file://localhost/E:/mindprod/jgloss.html or file:///E|/mindprod/jgloss.html.
    Composing just the right platform-specific command to launch browser and feed it a URL to display can be frustrating. You can use the BrowserLauncher package to do that for you.
    Note that
    rundll32.exe url.dll,FileProtocolHandler file:///E|/mindprod/jgloss.html
    won't work on the command line because | is reserved as the piping operator, though it will work as an exec parameter passed directly to the rundll32.exe executable.
    With explicit extensions and appropriately set up associations in Windows 95/98/ME/NT/2000/XP you can often bypass the command processor and invoke the file directly, even *.bat.
    Similarly, for Unix/Linux you must spawn the program that can process the script, e.g. bash. However, you can run scripts directly with exec if you do two things:
    Start the script with #!bash or whatever the interpreter's name is.
    Mark the script file itself with the executable attribute.
    Alternatively start the script interpreter, e.g.
    Runtime.getRuntime( ).exec (new String[]{"/bin/sh", "-c", "echo $SHELL"}";

  • How can I pass more than one parameters in PDK-URL services?

    Hi all,
    How can I pass more than one parameters in PDK-URL service? All samples on Portal Center shows just one parameter passing.
    <inputParameter class="oracle.portal.provider.v1.URLPortletParameter">
    <name>csz</name>
    <isMandatory>false</isMandatory>
    <displayName>What location do you want a map for (City, State or Zip)?</displayName>
    </inputParameter>
    How can I write the privider.xml file for passing multiple parameters?

    I answer to my question. I've got the answer.
    I repeatly write down the <inputParameter> tags, and it works.

  • How can I pass arguments from one MIDlet to another MIDlet

    Hi everybody !
    Can anybody help me in knowing that how can I pass the parameters from one
    MIDlets to another one in same application.
    I am devloping a application in which I am using more than two MIDlet and I
    want to transfer Parameter from one MIDlet to another one.
    I just explain what I have done....
    I made a MIDlet "A" and "B" in the same project using NetBeans IDE.
    In MIDlet "A" I create the Object of MIDlet "B" so that the constructor of
    MIDlet "B" is called and parameter can be transferred.
    But when I run the program it shows me two MIDlet on the screen, that I
    doesn't need.
    Suggestion are most welcome....
    Thanks in advance
    Regards
    Bhagwat

    If you create two MIDlet in a midlet suite, it will display as you mentioned means you can't change the display style.

  • How can I pass multiple condition in where clause with the join table?

    Hi:
    I need to collect several inputs at run time, and query the record according to the input.
    How can I pass multiple conditions in where clause with the join table?
    Thanks in advance for any help.
    Regards,
    TD

    If you are using SQL-Plus or Reports you can use lexical parameters like:
    SELECT * FROM emp &condition;
    When you run the query it will ask for value of condition and you can enter what every you want. Here is a really fun query:
    SELECT &columns FROM &tables &condition;
    But if you are using Forms. Then you have to change the condition by SET_BLOCK_PROPERTY.
    Best of luck!

Maybe you are looking for

  • Use Call Manager to play media over a paging system.

    We have a Bogen overhead paging system and would like to play some music from the Cisco system. It would be for playing Brahms Lullaby when a baby is born. We currently use the phone system to access the paging via a LS port on the back of our 2821 r

  • 808 pureview keeps shutting down and starting up.

    hi there my 808 keeps shutting down and staring up all the time.... at least 20-40 times  a day... i tried to reinstall the software on nokiasuite, but it didnt help.. anyone ??     rix

  • WAAS 4.1.1.23 secured_client detected

    why is the above error regarded as a major error? when it is an information message only. It means there is a secured mapi client detected also I cannot find the release notes for WAAS 4.1.1a.10 I take it there are some fixes not in 4.1.1.23

  • DataQueue on AS400 from Java to Cobol

    my java prog is called by a cobol prog with params and should return a 16char-string to the cobol prog. we will do that now with a dataqueue. tell me please how to use a dataqueue. or is there an easier possibility? string main(..) return string; doe

  • Policy Managed RAC database instance on different node

    Dear All, Recently we have upgrade our production database from 2 node 11.2.0.1/Solaris 10 Sparc to 2 node 12.1.0.2/Solaris 11.2 Sparc earlier was Admin managed database, now we have created Policy managed database. Instance_1 running on node_2 Instn