Passing parameter into stored procedure

Hi guys,
I have a big problem here passing as a parameter in stored
procedure.
If i pass as a parameter in where clause it is working fine.
Whenever i pass the parameter in order by it was not working..
How to implement this issue????
Here i am giving the example for package:
PACKAGE XTRA.TEST_STATUS
AS
TYPE GenericCurTyp IS REF CURSOR;
PROCEDURE SP_MAIN
( insortgroup IN VARCHAR2,GENERAL_CUR IN OUT GenericCurTyp);
END TEST_STATUS;
PACKAGE BODY XTRA.TEST_STATUS
AS
PROCEDURE SP_MAIN
( insortgroup IN VARCHAR2, GENERAL_CUR IN OUT GenericCurTyp
) AS
BEGIN
OPEN GENERAL_CUR FOR
select last_name,first_name from applicant Order By insortgroup;
END SP_MAIN;
END TEST_STATUS;
Passing as a parameter i am getting the below details.
LAST_NAME FIRST_NAME
ASFSDAF DASDFASF
Ad DASD
Adams John
DANA WITEST
If i hot code the parameter insortgroup to last_name
i am getting the below values:
LAST_NAME FIRST_NAME
'ANNUNZIO GIANCOLA GABRIEL
0'BRIEN ARMA
0120453EZ ESTANISLAO
082479 ELIZABETH
Thanks,
Rao

CREATE OR REPLACE PACKAGE xtra.test_status
AS
  TYPE GenericCurTyp IS REF CURSOR;
  PROCEDURE sp_main
    (insortgroup IN     VARCHAR2,
     general_cur IN OUT GenericCurTyp);
END test_status;
CREATE OR REPLACE PACKAGE BODY xtra.test_status
AS
  PROCEDURE sp_main
    (insortgroup IN     VARCHAR2,
     general_cur IN OUT GenericCurTyp)
  AS
    select_statement VARCHAR2 (4000) := NULL;
  BEGIN
    select_statement :=
    'SELECT   last_name,
              first_name
     FROM     applicant
     ORDER BY ' || insortgroup;
    DBMS_OUTPUT.PUT_LINE (select_statement);
    OPEN general_cur FOR select_statement;
  END sp_main;
END test_status;

Similar Messages

  • Passing parameter in stored procedure

    Hi, I am really new to using Oracle stored procedure. I have just tested a sample stored proc which should return multiple rows without passing any parameter.
    here is the stored proc I wrote
    create or replace procedure get_address
    as
    cur_table sys_refcursor;
    begin
    open cur_table for
    select * from address_table order by addr_id;
    end;
    when I execute it, I get a message "Procedure Created"
    then I executed the stored proc
    exec get_address;
    I again get a message "PL/SQL procedure successfully completed" and I do not see the records at all.
    so I decide to rewrite to the stored proc as such
    create or replace procedure get_address(cur_table out sys_refcursor)
    as
    begin
    open cur_table for
    select * from address_table order by addr_id;
    end;
    everthing is good so far.
    now when execute it
    exec get_address;
    I am getting the following error:
    "PLS-00306: wrong number or types of arguments in call to 'TESTCODEPROC'"
    I have searched so many places, but there is no document talks about this issue. I hope someone can help me to over come this. I need to call this stored proc from .NET 2.0 reporting viewer which is embedded in asp.net page.
    Thank you.

    so I decide to rewrite to the stored proc as such
    create or replace procedure get_address(cur_table out
    sys_refcursor)
    as
    begin
    open cur_table for
    select * from address_table order by addr_id;
    end;
    everthing is good so far.
    now when execute it
    exec get_address;
    I am getting the following error:
    "PLS-00306: wrong number or types of arguments in
    call to 'TESTCODEPROC'"
    From what you wrote I can assume that you have used SQL server before. Oracle does not automatically return the last opened cursor from a stored procedure like the query result, so you cannot just call exec get_address; (or just execute the procedure from .NET code). You will have to pass the cursor parameter and fetch it as an output parameter value in .NET, then use it to get the data reader etc.
    On the other hand, you can just execute the statement directly. I see a lot of folks coming from SQL server world using stored procedures like crazy even for things that are naturally suited to queries and views. Oracle view allows you to apply the same security restrictions you can put onto a stored procedure, and if you use statement caching and bound variables, you get precompilation benefits as well with a view. Using a view instead of a procedure in this case will require less code both in the database and in .NET, and will give you a more flexible interface in terms of retrieved columns and ordering.
    gojko adzic
    http://gojko.net

  • Passing parameter to stored procedure from windows form getting error

    I've written a procedure which shows the data in a table according to the table flag selected from the windows form. My code is:
    --- stored procedure ------
    CREATE PROC [dbo].[PROC_SELECT_TABLES]
    @TBL_FLAG INT
    AS
    BEGIN
    SET NOCOUNT ON;
    IF (@TBL_FLAG = 1)
    SELECT * FROM MHT_APPUSER ;
    IF (@TBL_FLAG = 2)
    SELECT * FROM MHT_ISA11 ;
    IF (@TBL_FLAG = 3)
    SELECT * FROM MHT_ISA22 ;
    SET NOCOUNT OFF;
    END
    GO
    Now, the module for calling the above procedure
    namespace DAL;
    public class DisplayData
    SqlLayer layer = new SqlLayer();
    public int tblFlag { get; set; }
    public DataTable GetData(int tblFlag)
    SqlParameter[] p = new SqlParameter[1];
    p[0] = new SqlParameter("@tblFlag", this.tblFlag);
    return layer.ExecuteDataSet("PROC_SELECT_TABLES", p).Tables[0];
    Now the SQL LAYER, containing the ExecuteDataSet and database connection code:
    namespace DAL;
    public class SqlLayer
    // sql connection code
    public DataSet ExecuteDataSet(string commandText, SqlParameter[] sqlParameter)
    SqlCommand cmd = new SqlCommand(commandText, this.conn);
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.Parameters.AddRange(sqlParameter);
    SqlDataAdapter sda = new SqlDataAdapter(cmd);
    DataSet ds = new DataSet();
    sda.Fill(ds);
    return ds;
    Now the windows form layer:
    using DAL;
    namespace BookKeepingSystem
    public partial class DisplayDataForm : Form
    DisplayData view = new DisplayData();
    private void GetData()
    view.tblFlag = 3;
    DataTable dt = view.GetData(view.tblFlag);
    dgvDisplayData.DataSource = dt;
    public DisplayDataForm()
    InitializeComponent();
    private void DisplayData_Load(object sender, EventArgs e)
    GetData();
    private void btnExit_Click(object sender, EventArgs e)
    Application.Exit();
    When I run the code I got the error:
    "Unhandled exception has occurred in your application...
    Procedure or function 'PROC_SELECT_TABLES' expects parameter @TBL_FLAG, which was not supplied"
    I can not figure what is missing with my code. Please can any one point out please.
    Thank You!!!

    Try something like this for starting -- do just this procedure to see if it works first.
    private DataTable GetDataTable(SqlConnection conn1)
    SqlDataAdapter daS1 = new SqlDataAdapter();
    daS1.SelectCommand = new SqlCommand();
    daS1.SelectCommand.Connection = conn1;
    if (conn1.State == ConnectionState.Closed) conn1.Open();
    daS1.SelectCommand.CommandType = CommandType.StoredProcedure;
    daS1.SelectCommand.CommandText = "yourStoredProcedureName";
    daS1.SelectCommand.Parameters.Add("@ParamName", SqlDbType.Int, 4);
    DataSet DS1 = new DataSet();
    daS1.Fill(DS1, "tbl1");
    return DS1.Tables["tbl1"];
    Note:  in the CommandText part place the name of your stored procedure.  In the Parameter part put the name of your parameter exactly as it is in the actual stored procedure.  Also, (if you have not done this already) make sure your stored
    procedure runs OK -- first -- test out your stored procedure in Sql Server Management Studio.  If the procedure runs OK in SSMS, then try it from you app.  Just create a simple form with one button .  Place GetDataTable() code under
    the button and call it something like this:
    private void button1_Click(object sender, EventArgs e)
    int i = GetDataTbl().Rows.Count;
    Console.WriteLine("i is {0}", i);
    Rich P

  • Passing Parameter to Stored Procedure from Form

    Hello All,
    I have been stuck while passing a form parameter to a database Procedure.In the query data source arguments I have provided the parameter Value as :parameter.parameter_1...Is it right...
    Can somebody throw some more light on this...
    Regards,
    Kaps

    You can pass the parameters from Forms through the Query Data Source Arguments of this block.
    There are a little example on http://www.Friedhold-Matz.de/appl_plan.htm.
    I used in block B the Query Data Source Arguments property to fill the
    procedure input arguments with the :PARAMTER.P_name of this Form.
    Hope it helps
    Friedhold

  • Is it possible to pass TABLE as the output parameter in stored procedure

    Hey Experts,
      Is it possible to pass TABLE as the output parameter in stored procedure.
    eg
    create procedure spGetData
    @tableName as TABLE(intValue INT NOT NUL)
    as 

    You can use OPENQUERY or OPENROWSET, as mentioned above, to make stored procedure results table like. There are
    some limitations with these methods:
    http://technet.microsoft.com/en-us/library/ms188427.aspx
    In OPENQUERY this-sql-server-instance can be used instead of a linked server name. It requires setting data accces server option:
    exec sp_serveroption @server = 'PRODSVR\SQL2012'
    ,@optname = 'DATA ACCESS'
    ,@optvalue = 'TRUE'
    LINK: http://www.sqlusa.com/bestpractices/select-into/
    Kalman Toth Database & OLAP Architect
    SELECT Video Tutorials 4 Hours
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Pass a date parameter to Stored Procedure

    Hello friends,
    Can you help to pass a date parameter to Stored procedure from JSP. This is my code:
    In Oracle 9i I have this:
    PROCEDURE SP_EDORES(
    pfechaini IN hist_pol_reclama.hrc_fecha_contabilidad%Type, <-- This is a date field
    pfechafin IN hist_pol_reclama.hrc_fecha_contabilidad%Type, <-- This is a date field
    p_recordset OUT PKG_REP_CIERRE.cursor_type) AS
    In JSP have this:
    CallableStatement stmt = (CallableStatement)conn.prepareCall( "begin PKG_REP_CIERRE.SP_EDORES(?,?,?); end;" );
    stmt.registerOutParameter(3,oracle.jdbc.driver.OracleTypes.CURSOR);
    stmt.setDate(1,Date.valueOf("01-06-2005"));
    stmt.setDate(2,Date.valueOf("30-06-2005"));
    ResultSet rset = (ResultSet)stmt.getObject(3);
    while (rset.next()) {
    %>
    <TR>
    <TD ALIGN=CENTER> <%= rset.getString(1) %> </TD>
    <TD ALIGN=CENTER> <%= rset.getString(2) %> </TD>
    <TD ALIGN=CENTER> <%= rset.getString(3) %> </TD>
    <TD ALIGN=CENTER> <%= rset.getInt(4) %> </TD>
    </TR>
    <%
    The Stored Procedure returns de Result set, however I think does not recognized the date format because I need it with this format dd-mm-yyyy.
    Thanks in advance

    to use Date you will need the oracle package.
    u can try this other solution: use String, not Date
    CallableStatement stmt = (CallableStatement)conn.prepareCall( "begin PKG_REP_CIERRE.SP_EDORES(?,?,?); end;" );
    stmt.registerOutParameter(3,oracle.jdbc.driver.OracleTypes.CURSOR);
    stmt.setString(1,"01-06-2005");
    stmt.setString(2,"30-06-2005");
    ResultSet rset = (ResultSet)stmt.getObject(3);
    while (rset.next()) {
    %>
    if this don't work you can change your PL/SQL to get Strings and do the conversion with TO_DATE in the sql statement.

  • Passing dynamic parameter to stored procedure from CR formula?

    Dear all,
    I need to insert in some textboxes the right string based on the desired Language Code.
    I crated a stored procedure in my db.
    CREATE PROCEDURE MY_GET_TRANSLATION
         @TextID nvarchar(8),
         @LangCode int
    This parameters are used as keys to get the Trans field.
    I created a workshop formula: GetTranslation
    Please, can someone suggest the correct statement to call my MY_GET_TRANSLATION  stored procedure passing parameters?
    I would like to call the GetTranslation formula from all my textboxes, passing the specific TextID value
    and visualized the right translated string.
    For example:
    in my TEXT1 textbox, I would like to call the GetTranslation formula passing the parameters
    TextID = "T000001"
    and
    LangCode = 13    (Italian language)
    How can pass dynamic parameters to a formula?
    How can pass dynamic parameters to a stored procedure from a CR formula?
    Regards
        Emanuele

    Dear Jason,
    I'm trying to modify a SAP B1 CR marketing report.
    This CR marketing document is called by SAP B1 automatically passing the Document Number and Document Type.
    The report uses the right SAP B1 tables to read the information of the header and rows of the document.
    The language of the document is contained in a field of the header table
    {MyMarketingDocTable.LanguageID}
    I created a user table named "MyTranslationTable" where I added some strings in different langiages.
    For example:
    TexiID            TextString              LangID
    T00001          Delivery                          8      
    T00001          Consegna                     13       (Italian translation)
    T00002          Invoice                           8
    T00002          Fattura                         13       (Italian translation)
    In the header of the report I'd like, for example, to visualise the string "Consegna" if my document is a delivery in italian language.
    I'd like to implement this method to translate all the textboxes (header, comments, etc.) based on the languageID of my document.
    For each textboxes, in the CR designer statically I know what TextID I want to visualized but dinamically I need to pass to my stored procedure the right language. I'd like my report automatically gets the language at run-time. I don't want that when I press the Print-preview button in SAP B1, the report asks to prompt the languageID.
    It already read the DocNum and DocType and it already filter the SAP B1 tables basing on the DocNum and DocType of the document. In this way it reads the right row in the SAP B1 table and in this way I can read all the fields of this row (also the languageID of the actual document).
    Regards
        Emanuele
    Edited by: Emanuele Croci on Dec 3, 2010 9:03 AM

  • Size limitation that can be passed to Java stored procedure

    Hello!
    I enjoy using Oracle8i these days. But I have some questions
    about Java stored procedure. I want to pass the XML data to Java
    stored procedure as IN parameter. But I got some errors when the
    data size is long. Is there any limitation in the data size that
    can be passed to Java stored procedure?
    Would you please help me ?
    This message is long, but would you please read my message?
    Contents
    1. Outline : I write what I want to do and the error message I
    got
    2. About the data size boundary: I write about the boundary
    size. I found that it depend on which calling sequence I use.
    3. The source code of the Java stored procedure
    4. The source code of the Java code that call the Java stored
    procedure
    5. The call spec
    6. Environment
    1.Outline
    I want to pass the XML data to Java stored procedure. But I got
    some errors when the data size is long. The error message I got
    is below.
    [ Error messages and stack trace ]
    java.sql.SQLException: ORA-01460: unimplemented or unreasonable
    conversion reque
    sted
    java.sql.SQLException: ORA-01460: unimplemented or unreasonable
    conversion reque
    sted
    at oracle.jdbc.ttc7.TTIoer.processError(Compiled Code)
    at oracle.jdbc.ttc7.Oall7.receive(Compiled Code)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(Compiled Code)
    at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch
    (TTC7Protocol.java:721
    at oracle.jdbc.driver.OracleStatement.doExecuteOther
    (Compiled Code)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithBatch
    (Compiled Code)
    at oracle.jdbc.driver.OracleStatement.doExecute(Compiled
    Code)
    at
    oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(Compiled
    Code
    at
    oracle.jdbc.driver.OraclePreparedStatement.executeUpdate
    (OraclePrepar
    edStatement.java:256)
    at oracle.jdbc.driver.OraclePreparedStatement.execute
    (OraclePreparedStat
    ement.java:273)
    at javaSp.javaSpTestMain.sample_test
    (javaSpTestMain.java:37)
    at javaSp.javaSpTestMain.main(javaSpTestMain.java:72)
    2. About the data size boundary
    I don|ft know the boundary that I got errors exactly, but I
    found that the boundary will be changed if I use |gprepareCall("
    CALL insertData(?)");|h or |gprepareCall ("begin insertData
    (?); end ;")|h.
    When I use |gprepareCall(" CALL insertData(?)".
    The data size 3931 byte ---&#61664; No Error
    The data size 4045 byte ---&#61664; Error
    Whne I use prepareCall ("begin insertData(?); end ;")
    The data size 32612 byte --&#61664;No Error
    The data size 32692 byte ---&#61664; Error
    3. The source code of the Java stored procedure
    public class javaSpBytesSample {
    public javaSpBytesSample() {
    public static int insertData( byte[] xmlDataBytes ) throws
    SQLException{
    int oraCode =0;
    String xmlData = new String(xmlDataBytes);
    try{
    Connection l_connection; //Database Connection Object
    //parse XML Data
    dits_parser dp = new dits_parser(xmlData);
    //Get data num
    int datanum = dp.getElementNum("name");
    //insesrt the data
    PreparedStatement l_stmt;
    for( int i = 0; i < datanum; i++ ){
    l_stmt = l_connection.prepareStatement("INSERT INTO test
    " +
    "(LPID, NAME, SEX) " +
    "values(?, ?, ?)");
    l_stmt.setString(1,"LIPD_null");
    l_stmt.setString(2,dp.getElemntValueByTagName("name",i));
    l_stmt.setString(3,dp.getElemntValueByTagName("sex",i));
    l_stmt.execute();
    l_stmt.close(); //Close the Statement
    l_stmt = l_connection.prepareStatement("COMMIT"); //
    Commit the changes
    l_stmt.execute();
    l_stmt.close(); //Close the Statement l_stmt.execute
    (); // Execute the Statement
    catch(SQLException e ){
    System.out.println(e.toString());
    return(e.getErrorCode());
    return(oraCode);
    4. The source code of the Java code that call the Java stored
    procedure
    public static void sample_test(int num) {
    //make data
    Patient p = new Patient();
    byte[] xmlData = p.generateXMLData(num);
    try{
    // Load the Oracle JDBC driver
    DriverManager.registerDriver(new
    oracle.jdbc.driver.OracleDriver());
    Connection m_connection = DriverManager.getConnection
    ("jdbc:oracle:thin:@max:1521:test",
    "testuser", "testuser");
    CallableStatement l_stmt =
    // m_connection.prepareCall(" CALL insertData(?)");
    m_connection.prepareCall("begin insertData(?); end
    l_stmt.setBytes(1,xmlData);
    l_stmt.execute();
    l_stmt.close();
    System.out.println("SUCCESS to insert data");
    catch(SQLException e ){
    System.out.println( e.toString());
    e.printStackTrace();
    5. The call spec
    CREATE OR REPLACE PROCEDURE insertData( xmlData IN LONG RAW)
    AS
    LANGUAGE JAVA NAME 'javaSp.javaSpBytesSample.insertData(byte[])';
    6. Environment
    OS: Windows NT 4.0 SP3
    RDBMS: Oracle 8i Enterprise Edition Release 8.1.5.0.0 for
    Windows NT
    JDBC Driver: Oracle JDBC Drivers 8.1.5.0.0.
    JVM: Java1.1.6_Borland ( The test program that call Java stored
    procedure run on this Java VM)
    null

    Iam passing an array of objects from Java to the C
    file. The total size of data that Iam sending is
    around 1GB. I have to load this data into the Shared
    memory after getting it in my C file. Iam working on
    HP-UX (64-bit). Everything works fine for around 400MB
    of data. When I try to send around 500MB of data, the
    disk utilization becomes 100%, so does my memory
    utilization and I get a "Not enough space" when I try
    to access shared memory. I have allocated nearly 2.5GB
    in my SHMMAX variable. Also, I have around 45GB of
    disk free. The JVM heap size is also at 2048MB. Where did you get the 400/500 number from? Is that the size of the file?
    What do you do with the data? Are you doing nothing but copying it byte for byte into shared memory?
    If yes then a simple test is to write a C application that does the same thing. If it has problems then it means you have an environment problem.
    If no then you are probably increasing the size of the data by creating a structure to hold it. How much overhead does that add to the size of the data?

  • Is it possible to receive a String[] back into stored procedure?

    Hi,
    Is it possible to return String [] into plsql procedure?
    I have a class :
    class CreditCard {
    public static String cc (String args []) []
    throws
    SQLException, ClassNotFoundException
    I load it into the database and then create a plsql procedure:
    CREATE OR REPLACE PROCEDURE check_credit(
    card_number IN          VARCHAR2,
    exp_month IN          VARCHAR2,
    exp_year      IN          VARCHAR2,
    flag1      OUT varchar2,
    flag2          OUT varchar2)
    AS LANGUAGE JAVA
    NAME 'CreditCard.cc(java.lang.String[]) return java.lang.String[]';
    trying to compile it gives me:
    20/1 PLS-00311: the declaration of "CreditCard.cc(java.lang.String[])
    return java.lang.String[]" is incomplete or malformed
    Is it possible to receive a String[] back into stored procedure?
    Thanks
    Leonid

    I don't think you can use a String Array directly, you have to use an oracle.sql.ARRAY.
    You use the oracle.sql.ARRAY parameter in Java as an OUT parameter in the stored procedure. You need to use an ArrayDescriptor which requires a corresponding Oracle Nested Table type.
    Try something like the following:
    First the Nested Table Type:
         CREATE OR REPLACE TYPE
         TBL_STRINGS AS TABLE OF VARCHAR2(999);
    Then the Java method:
    public static void getStrings(oracle.sql.ARRAY[] theStrings) //has to be an array of oracle.sql.ARRAY's as we use it as an OUT parameter
    try
         //get a connection
         Connection conn = DriverManager.getConnection("jdbc:default:connection:");
         String [] colours = new String []{"RED", "GREEN", "GOLD"};
    ArrayDescriptor desc = ArrayDescriptor.createDescriptor("TBL_STRINGS", conn);
    theStrings[0] = new oracle.sql.ARRAY(desc, conn, colours);
         conn.close();
    catch (SQLException sqle)
              //report error
    Then the call spec:
         PROCEDURE GET_STRINGS(p_the_strings     OUT     TBL_STRINGS)
         AS LANGUAGE JAVA
         NAME 'mypackage.MyClass.getStrings(oracle.sql.ARRAY[])';

  • REF CURSOR as IN parameter to stored procedure

    Currently, ODP.NET supports REF CURSOR parameter as OUT parameter only.
    Based on the project requirements it is necessary to pass
    multiple records to the stored procedure.
    In this case REF CURSOR as IN parameter is useful.
    What are the plans to implement REF CURSOR as IN parameter to stored procedure?
    What is the work around in case it is necessary to pass several different
    record types as arrays to stored procedure?

    ODP.NET does not limit REF Cursor parameters to IN parameters. This is a known PL/SQL limitation.
    An excerpt from Application Developer's Guide:
    "If you pass a host cursor variable to PL/SQL, you cannot fetch from it on the server side unless you also open it there on the same server call".

  • How to pass parameter into a source variable of a invoke activity

    I'm an new BPELer, I created a invoke activity to submit Oracle Appplications concurrent program, but I don't know how to pass parameter into source variable.
    BTW, I have created the mapper file (.xsl) file.
    could anyone tell me how to do that?
    Thanks,
    Victor

    Hi.
    How you start application? I think you send message to webservice(BPEL process is webservice too). So construct message with variable and value.
    But I created only processes where input value doesn't matter. I haven't use mapper yet too.

  • How to pass parameter into extract function (for XMLTYPE)

    I have a table PROBLEMXML with XMLTYPE field xml_column. In this column there are several deffinitions for the problem. There is no max amount of deffinitions and it can be no definition at all. I need to return all definitions for every problem as a string wirh definitions separated by ";".
    Query
    SELECT extract(prob.Def,'/Definitions/Definition[1]/@var') || ';'|| extract(prob.Def,'/Definitions/Definition[2]/@var')
    FROM PROBLEMXML j ,
    XMLTABLE (
    '/problem'
    PASSING j.xml_column
    COLUMNS probid VARCHAR (31) PATH '/problem/@id',
    Def XMLTYPE PATH '/problem/Definitions') prob
    where PROBLEM_ID =1;
    returns exactly what I want a;m.
    But
    declare
    my_var varchar2(2000) :=null;
    n1 number;
    n2 number;
    begin
    n1:=1;
    n2:=2;
    SELECT extract(prob.Def,'/Definitions/Definition[n1]/@var') || '|'|| extract(prob.Def,'/Definitions/Definition[n2]/@var') into my_var
    FROM ETL_PROBLEMXML_STG_T j ,
    XMLTABLE (
    '/problem'
    PASSING j.xml_column
    COLUMNS probid VARCHAR (31) PATH '/problem/@id',
    Def XMLTYPE PATH '/problem/Definitions') prob
    where PROBLEM_ID =1;
    dbms_output.put_line(my_var);
    end;
    returns NULL.
    Is there is a way to pass parameter into extract function?

    I need to return all definitions for every problem as a string wirh definitions separated by ";".In XQuery, there's the handy function "string-join" for that.
    For example :
    SQL> WITH etl_problemxml_stg_t AS (
      2   SELECT 1 problem_id,
      3  xmltype('<problem id="1">
      4   <Definitions>
      5    <Definition var="var1"></Definition>
      6    <Definition var="var2"></Definition>
      7    <Definition var="var3"></Definition>
      8   </Definitions>
      9  </problem>') xml_column
    10   FROM dual
    11  )
    12  SELECT j.problem_id,
    13         prob.probid,
    14         prob.def
    15  FROM etl_problemxml_stg_t j,
    16       XMLTable(
    17        'for $i in /problem
    18         return element r
    19         {
    20          $i/@id,
    21          element d { string-join($i/Definitions/Definition/@var, ";") }
    22         }'
    23        passing j.xml_column
    24        columns
    25         probid varchar2(30)  path '@id',
    26         def    varchar2(100) path 'd'
    27       ) prob
    28  ;
    PROBLEM_ID PROBID               DEF
             1 1                    var1;var2;var3

  • How to pass parameter into transaction iview ?

    Hi experts,
    I want to know "how to pass parameter into transaction iview ".
    Regards,
    Krishna Balaji T

    Hi Krishna,
    Not sure if this can help you.
    1) Passing a parameter to a transaction iview (I saw a resolved suggestion)
    Passing a parameter to a transaction iview
    2) Passing a parameter from the portal to R3 (helpful info for you)
    Passing a parameter from the portal to R3
    3) Create SAP Transaction iView using SAPGUI for Windows (Great Blog and info about TA Iview)
    Create SAP Transaction iView using SAPGUI for Windows
    Please check the following link for Transaction Iviews
    http://help.sap.com/saphelp_nw2004s/helpdata/en/02/f9e1ac7da0ee4587d79e8de7584966/frameset.htm
    Just some info: Portal is basically what the end user can see. What he can do, is still maintain in the backend system. If there are parameters setup already for the user in the backend system (in SU01), then those parameters should still valid for the transaction that the parameters are linked to.
    Hope that helps and award points for helpful suggestions.
    Ray

  • Return a parameter through stored procedures

    Hello Experts
    I want to return parameter through stored procedures so as to ensure that the application has been executed properly.
    My source message format is
    <StatementName5>
    <storedProcedureName action=u201D EXECUTEu201D>
      <table>Summarize_prc</table>
    <empid  [isInput=u201Dtrueu201D] [isOutput=true] type=SQLDatatype>val1</empid>
    </storedProcedureName > 
    </StatementName5>
    Do i need to put some extra parameters for return values from the stored procedures?
    What would be the response message format to return the parameters from stored procedure.
    Thanks
    Sabyasachi

    Hi,
    If you wants to read the return values from stored procedure, the scanario should be designed as Sync.
    The format looks like thsi
    <Message Type Name>
          <STATEMENTNAME_response>
                      <Field1> </Field1>
       </STATEMENTNAME_response>
    </Message Type Name>

  • Passing multi-value parameter in stored procedure ssrs

    I have  customer parameter which is a drop down list in my report and I have set it to "allow multiple values". This is an SSRS report.
    How do I pass multiple values to my stored procedure?
    RJ

    Hi ,
    Create a Table valued function in SQL Functions  as below 
    Step 1
    CREATE FUNCTION [dbo].[FnSplit]
    @List nvarchar(2000),
    @SplitOn nvarchar(5)
    RETURNS @RtnValue table 
    Id int identity(1,1),
    Value nvarchar(100)
    AS  
    BEGIN
    While (Charindex(@SplitOn,@List)>0)
    Begin 
    Insert Into @RtnValue (value)
    Select
    Value = ltrim(rtrim(Substring(@List,1,Charindex(@SplitOn,@List)-1))) 
    Set @List = Substring(@List,Charindex(@SplitOn,@List)+len(@SplitOn),len(@List))
    End 
    Insert Into @RtnValue (Value)
    Select Value = ltrim(rtrim(@List))
    Return
    END
    Step 2 in your store procedure change the parameter where condition something like below
    ALTER PROCEDURE [dbo].[SomeSP] 
    -- Add the parameters for the stored procedure here
    @CostCentre NVARCHAR(255)
    SELECT
    [ProjectCode],[ProjectName],[ProjectManager],SUM([Hours]) AS [Hours MTD]FROM dbo.Rpt_NRMA_CATS NC
    INNER JOIN PeriodID P ON NC.PeriodID=P.PeriodID
    WHERE 
    ([CostCentre]) collate database_default IN(SELECT Value FROM dbo.FnSplit(@CostCentre,','))
    END
    I hope this will help you.
    Dasari

Maybe you are looking for

  • Adobe Acrobat 7 on Windows Vista Home Basic.

    I have windows vista home basic. I need to download adobe acrobat 7 but a message comes on saying it is not compatible to this type of windows. How do I remedy this?  Thanks.

  • FM For Finding if Material BOM exits for BOM component.

    Hi, Is there any FM or BAPI to find out if there is any material BOM exists for the BOM component. How is Indicator assembly get assighned..? Any inputs would be appreciated. Thanks, Mark

  • Re: Can I change from 32 to 64bit?

    Is it possible to change settings to 64 bit after the quick installation. Just bought this and with 4GB of mem probably chose wrong option?

  • Database query tool

    Does there exist some kind of common teststand database query tool/gui/form or do all testengineers have to develop their own application for retrieving data ? I'm using standard TS schema, and Access DB. I'm sure there are 100's of homemade tools ou

  • Spaning tree Not working On L2 Links

      Hi,    I am facing problem in spaning tree over L2 links between my core switch in braanch to data centre switch, please find my network digram for your understanding,   1) we have two 4500 switches in my HO as a core there are two links are connec