How to pass input value to the IN parameter in a function

Hi ,
I'm new to pl/sql programming.
The below function is used inside a package and the package is invoked in visual studio.
The function uses 2 input parameters.
Out of which 'in_report_parameter_id' value comes thru job processor service 's job request.
The second IN paramter values are hard coded in the function.
I'm not able to understand this.
If the values are hard coded , how to make sure that only the hard coded values are the right ones?
Please anyone could explain to me?
I really dont have good idea about how to pass INPUT parameter to the functions or procedure
Is there any nice document which could give me good understanding about what are the ways or types we could pass values to the input parameter in subprograms?
thanks in advance.
CREATE OR REPLACE FUNCTION get_class_text_str
     in_report_parameter_id IN NUMBER,
     in_which                IN VARCHAR2 DEFAULT 'SELECT'
RETURN VARCHAR2
IS
         end_text            VARCHAR2 (50)   := '';
         my_class_text_str  VARCHAR2(10000) := '';
         my_class_value_str VARCHAR2(10000) := '';
     CURSOR class_text(c_1_text VARCHAR2, c_2_text VARCHAR2) IS
     SELECT c_1_text || report_parameters.report_parameter_value
                           || c_2_text
                           || report_parameters.report_parameter_value
                           || '" '
      FROM report_parameters
     WHERE report_parameters.report_parameter_id     = 3690
       AND report_parameters.report_parameter_group  = 'CLASS'
       AND report_parameters.report_parameter_name   = 'CLASS'
GROUP BY report_parameters.report_parameter_value
ORDER BY CAST(report_parameters.report_parameter_value AS NUMBER);
BEGIN
     IF (in_which = 'SUM') THEN     
          OPEN class_text ( 'SUM(NVL("Class ', '", 0)) "Class ' );
     ELSIF (in_which = 'PERC')THEN
          OPEN class_text ( 'ROUND((("Class ', '" / "Total") * 100), 2) "Class ' );
          end_text := ', DECODE("Total", -1, 0, 100) "Total" ';
     ELSE
          OPEN class_text ( 'SUM(DECODE(bin_id, ', ', bin_value, 0)) "Class ' );
     END IF;
     LOOP
          FETCH class_text INTO my_class_value_str;
          EXIT WHEN class_text%NOTFOUND;
          my_class_text_str := my_class_text_str || ', ' || my_class_value_str;
     END LOOP;
     CLOSE class_text;
     my_class_text_str := my_class_text_str || end_text;
     RETURN my_class_text_str;
END get_class_text_str;
/Edited by: user10641405 on Nov 19, 2009 8:16 AM
Edited by: user10641405 on Nov 19, 2009 8:30 AM

This is not a design I would use, but should work if coded properly. I would probably build a reference cursor query as text and use one open fetch and close.
You have 2 input parameters, in_report_parameter_id and in_which. I could not find where in_report_parameter_id was used in the program, but the value passed in for in_which is being used in IF logic to decide how to open the cursor. After the cursor is open rows are being fetched and eventually the cursor is closed.
The values in_which are compared to are hard-coded. It is the programmer's job to make sure the values listed are the right values and the actions taken are also correct. Your program is assuming that if the first 2 values are not encountered the third one listed is the one you want.
To pass input values to a procedure you merely provide the values as a literal or variable in the call, something like
whatever := get_class_text_str(1,'SELECT');

Similar Messages

  • How to pass a value to the export parameter for a method (public instance)?

    Hello,
      I am trying ABAP OO newly. How to pass a value to the export parameter for a method (public instance) called in a report? This *export parameter has a reference type of structure.
    Thanks in advance,
    Ranjini

    Hi,
    "class definition
    class lcl... definition.
      public section.
        method m1 imporitng par type ref to data.  "now you can pass any reference to the method, but this way you have to maintain this reference dynamically inside the method (you can't be sure what that reference is really "pointing" at)
    endclass.
    "in program
    data: r_lcl type ref to lcl...
    create object r_lcl.
    call method r_lcl
      exporting
         par    =  "pass any reference variable here
    Regards
    Marcin

  • How to pass a value from the report to a form ( BIT OF URGENT ).

    Hi,
    I had created a "Form on a Table with Report" on the report I had remove the edit link and set one of the column feilds that functionality. Now I want to know how to pass that value that is clicked ( having hyper link ) on to the form where it runs a SQL query and then displays the reuslts on the form.
    Illustrating with an example.
    I am having these following columns on the report ( these are the results for the join statement )
    JOBNUM JOBNAME DEPTNUMBER SAL EMPNO LNAME FNAME
    In the above JOBNUM is having Hyper link as I removed the edit image.
    Now this is area I am having problem. When the user clicked on the JOBNUM then on form it should display 20 other columns( pulled from 5 other tables ) which are related to that particualr JOBNUM.
    Anybody give me a solution in which area I have to include my SQL statement and how to pass that selected value to that SQL statement.
    Cheers,
    Krishna

    Hi Ron,
    I am doing exaclty what you have suggested me but no luck. I started changing the DEMO_CUSTOMERS application to my requirements.The report is working fine and on the report I have created a page attribute to the Hyper linked column and linked that to the page 2 and assign that attribute with #JOBNUM#.
    I am able to pass that value on to form when I click on the JOBNUM. But the problem is I am not able to pass that value into the SQL query so that my query pulls 20+ columns on to the Form ( which is second page ).
    Small clarification... On the form region it is said FORM NAME and type is HTML is that is the way the APEX was designed or does it need to say region type as FORM.
    Thanks for your help in advance.
    Cheers,
    Krishna.

  • How to pass a value of the radiogroup to another page item

    Hi, I have a report with one column as a radiogroup. I have a process that execute the next code when I press a button:
    begin
    for i in 1..htmldb_application.g_f01.count
    loop
    update mesa_entrada set retomada = sysdate where id = htmldb_application.g_f01(i);
    end loop;
    end;
    I want to set the value of the item in another page with the value of the selected radiogroup, How i have to do?
    any suggestion will be welcome!
    Thanks!

    I have the same problem.
    On the new page the global variable HTMLDB_ITEM.G_F01 has 0 values.
    I created a process like this in the new page:
    :P300_FILENAME := HTMLDB_APPLICATION.G_F01.count;
    FOR I IN 1..HTMLDB_APPLICATION.G_F01.COUNT
    LOOP
    :P300_TEST := HTMLDB_APPLICATION.G_F01(I);
    END LOOP;
    and P300_FILENAME gets 0 and P300_TEST is empty. Any sugestions?

  • How to pass multiple values to a single parameter in BW report URL

    Hi Experts,
    I am new to EP and learning .... i am stuck at one point where we need to pass multiple parameters to a BW report URL, this is the URL that we launch from BSP.... Suppose i have to pass different multiple values to a single parameter, how to do it....
    i m getting many answers to pass parameters to iviews, reports, but not specific to my case.. can u plz help me....
    Thanks in advance
    Priya Rai

    What is the prolem you are facing if you split the single date param as two parameters say startdate and enddate?
    If you pass as single string then you might have to split the same at reciever end.
    Are you trying any thing specific?

  • How to choose  optimal value for  the OPEN_CURSOR parameter in init.ora?

    15:05:35 SQL> select count(*) from v$open_cursor;
    COUNT(*)
    5159
    15:06:28 SQL> select count(*) from v$open_cursor WHERE user_name='USER1';
    COUNT(*)
    2369
    15:06:48 SQL> select count(*) from v$open_cursor WHERE user_name='USER2';
    COUNT(*)
    686
    Currently, application using these number of open cursors?
    How to set the optimal value for this application?

    Hi,
    >>With the above setting I have yet to get any errors due to cursor limits. A good trade off memory v issues.
    To see if you have set OPEN_CURSORS high enough, monitor v$sesstat dynamic performance view using the SQL below for the maximum opened cursors. If your sessions are running close to the limit, maybe you should increase the value of OPEN_CURSORS.
    select max(a.value) as highest_open_cur, p.value as max_open_cur
    from v$sesstat a, v$statname b, v$parameter p
    where a.statistic# = b.statistic#
    and b.name = 'opened cursors current'
    and p.name= 'open_cursors'
    group by p.value;In addition, I advise you to take a look at your PL/SQL code in order to see if the explicit cursors have been close (if it was the case), or if your SQL code can be tuned ...
    Cheers
    Legatti

  • How to pass multiple values from workbook to planning function ?

    Hi,
    I have created Planning function in Modeler and it has one parameter(Variable represents = Multiple single values).
    When executing the planning function by create planning seq. in the web template : I see value of variable store data like ...
        A.) input one value -> V1
        B.) input three values -> V1;V2;V3
    This function execute completely in web.
    However, I want to use the planning function in workbook(Excel).
    The value of variable can't input V1;V2;V3... I don't know how to pass multiple values from workbook to parameter(Multiple single values type) in planning function ?
    thank you.

    Hi,
    Please see the attached how to document (page no 16).
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0881371-78a1-2910-f0b8-af3e184929be">how to</a>
    Hope this was helpful
    thanks

  • Passing  null values to the attributes of a CAF operation

    Hi,
    In CAF I am trying to fetch data through Web Service. For this I need to pass null value for the attributes of the operation.If I set the value to null it gives me missing parameter as the error.
    Can anyone tell me how to pass null values to the attributes of a CAF operation?

    Hi Xavier,
    Declare the two variables of type if_wd_contex_node for e.g. lv_node and if_wd_context_element for e.g. lv_element. Now in the first one lets say lv_node get the refrence of dynamically created node like:
    lv_node = wd_context->get_child_node('<node name>').
    Then get the refrence of element like:
    lv_element = lv_node->get_element( ). (You can also pass index as parameter check the method API)
    then just set the value of attribute you want like:
    lv_element->set_attribute( exporting name = '<attribute name>' value = '<your value>').
    Regards,
    Neha

  • How to pass Z values to workflow.

    Hi all,
    I would like to pass values of a Z table to step of workflow, specifically to condition step. I need to pass the entries values defined in Z table to compare material group of REQREQ to them.
    Is possible it?
    is there another solution to do it?
    Many Thanks.
    Regards,
    David.

    Hi David,
    I am not sure what your exact requirement is, but to access the Ztable you can follow this approach. Create an Activity task in workflow and make a call to a BO method. In this method query the Ztable to fetch the values to be used in the workflow. Pass these values in the export parameter of the BO method.
    Access the parameter in a multiline workflow container element and then use it in the workflow where ever desired.
    Hope this helps!
    Regards,
    Saumya

  • 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 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 to pass multiple query string values using the same parameter in Query String (URL) Filter Web Part

    Hi,
    I want to pass multiple query string values using the same parameter in Query String (URL) Filter Web Part like mentioned below:
    http://server/pages/Default.aspx?Title=Arup&Title=Ratan
    But it always return those items whose "Title" value is "Arup". It is not returned any items whose "Title" is "Ratan".
    I have followed the
    http://office.microsoft.com/en-us/sharepointserver/HA102509991033.aspx#1
    Please suggest me.
    Thanks | Arup
    THanks! Arup R(MCTS)
    SucCeSS DoEs NOT MatTer.

    Hi DH, sorry for not being clear.
    It works when I create the connection from that web part that you want to be connected with the Query String Filter Web part. So let's say you created a web part page. Then you could connect a parameterized Excel Workbook to an Excel Web Access Web Part
    (or a Performance Point Dashboard etc.) and you insert it into your page and add
    a Query String Filter Web Part . Then you can connect them by editing the Query String Filter Web Part but also by editing the Excel Web Access Web Part. And only when I created from the latter it worked
    with multiple values for one parameter. If you have any more questions let me know. See you, Ingo

  • Passing Input values to Adapter Module

    Hi
    I have write some simple adapter module in my sender file adapter.
    in order to make it more flexible i need to pass 2 input parameters  at run time so that I can update the Values in SAP tables using JCO CALL along with filename.
    please advise how to get pass input value from my ejb module.
    regards
    Gabriel

    >
    Gabriel Sagaya Selvam wrote:
    > Hi
    > I have write some simple adapter module in my sender file adapter.
    > in order to make it more flexible i need to pass 2 input parameters  at run time so that I can update the Values in SAP tables using JCO CALL along with filename.
    >
    > please advise how to get pass input value from my ejb module.
    >
    > regards
    > Gabriel
    refer this blog - https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/6107. [original link is broken] [original link is broken] [original link is broken]
    you can add flexibility by adding the module key parameters. Base the code as a reference where the author uses parameters configured in the adapter to be used to in the logic

  • How to pass a value to a bind variable in a query report in oracle apex

    Hi Guys,
    I have requirement to send weekly reports via email to some users. The users should receive their own records in the report. The user details is stored in a table. What I am planning to do is to create a report query in oracle apex to generate the report and then run a function/procedure via a scheduler to email the report to respective users. Now my query is ............. is it possible to pass a value (user name) to the report query to pull records of only that user? I know we can have bind variables in the report query but I have no idea how to pass a value for bind variables from a function/procedure.
    Can anyone help me on this issue or suggest a better approach?
    Thanks,
    San

    You need to use dynamic sql
    But please keep in mind that since you're using Oracle you may be better off posting this in some Oracle forums
    This forum is specifically for SQL Server
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Passing multiple values to the QUERY BDOC parameter?

    hi All,
    Below is my Query BDOC Anchor Before Query Execute even handler... I'm trying to pass multiple values to the         bq.Z_PartnerFunction query parameter... i.e. 
    PARTNER_FCT in( '00000012','ZDIVMGR','ZAREADR')
    is it possible without creating new Query Bdoc ?
    ====================================
    Private Sub aempchoicewinTCWSearchTAnchor_beforeQueryExecute(ByRef bq As BusinessQuery, ByRef cancel As Boolean)
    If Not bq Is Nothing Then
            If sWcDummy = "Yes" Then
                    bq.WcDummy = sWcDummy
            End If
            bq.Z_PartnerFunction = "00000012"
            If ctrlZ_Territory.Value <> "" Then
                 bq.PRNB_TerrID = "*" & ctrlZ_Territory.Value
            End If
    End If
    End Sub
    ================================
    Thanks in advance
    Hetal

    Hi,
    it looks that you already enhanced the query BDoc because you have a new query parameter bq.Z_PartnerFunction, right?
    To which BDoc parameter is this BQ parameter mapped? And how looks the related where clause?
    For a single filter normally a "=" operator is used. Therefore your example with "in" won't work.
    If these three partner functions are fixed then you might hardcoded them directly in the where clause (supposed the BDoc is not used somewhere else where you don't want to have this filter).
    Or you might add 3 new BDoc parameters, add 3 new where clauses using a disjunction for them (and using an embracing bracket). In this case always all these 3 BQ parameters need to be filled (or all stay empty) to avoid a SQL syntax error.
    Regards,
    Wolfhard

Maybe you are looking for

  • Looking for a notepad to snych with PC

    I am looking for an iPhone app which will allow me to do the following: * Write short texts (notes) on the iPhone * Write short texts (notes) on the PC * Conveniently copy / sych them between PC and iPhone I do NOT look for a web app, but need an app

  • PDF File opening error

    Hi, I have an BSP application in which I am fetching the pdf file data from an oracle table to a variable of data type xstring. Now I have to display this xstring again in pdf format in this BSP. The pdf file is generated but while opening it is givi

  • Error in EA10..

    While creating mass bills through EA10, only first bill is processed..it is giving me following error... "Formal error in table FKKOP: Item numbering is inconsistent" Diagnosis The line item numbering is incorrect. The items must be numbered in ascen

  • How to increment a character variable?

    Hi, I need to increment v_chgno by 1. But the following code gives me runtime error. Please can anyone guide me where i am going wrong. Data:  v_chgno TYPE char12 value 'CR0000000000',           v_newchgno TYPE char12. v_newchgno = v_chgno + 1. Thank

  • Intial e-mail address no longer valid and cannot g...

    Hi, i have created a new account to ask this question but would prefer to use my old account. my skype has always stayed logged in and the other day it logged out for some reason. i have now forgotten my password but i cannot reset it because my e-ma