IN OUT parameters in Stored Procedures

can anybody explain in detail what is in and out parameters in oracle stored procedures.
thanks in advance

IN is used to specify parameters that are input to the stored procedures. OUT is used to specify parameters that can be returned from the stored procedures.
Please don't get confused with procdures returning value.. You don't need to write a return statement.. just assigning the values to OUT parameters is good ebnough to retireve there values outside stored procedures.
Hope it helps.

Similar Messages

  • URGENT!!! a way to find out if Oracle stored procedures have OUT parameters

    I'm having problemes properly creating a string for the prepareCall().
    so that i can call up a stored procedure in oracle.
    the problem is that some stored procedures have OUT parameters that I have to register, and some stored procedures don't.
    how can i find out if a stored procedure has an OUT parameter or not?
    So that i can format a string with one less ? for statements that don't,
    and one more ? for statements that do have an OUT parameter.
    is there such a method as boolean OUTparameterExist();
    or i'll take any suggestions.

    any other solutions?That was the solution. You don't need to execute any sql statement to get Database Meta Data. You just need a connection, which you use to get the DatabaseMetaData instance
    DatabaseMetaData dbmd = connection.getMetaData();then invoke any of the (numerous) methods to get the info you require
    ResultSet rs = dbmd.getProcedureColumns("mydb","myschema","myproc",null);
    while(rs.next()) {
      String name = rs.getString("COLUMN_NAME");
      if (rs.getShort("COLUMN_TYPE")==DatabaseMetaData.procedureColumnOut) {
        // column is an OUT parameter
    }Dave

  • Arrays as IN/OUT parameters to stored procs

    I need the ability to pass Java arrays as input parameters and receive arrays as output parameters from stored procedures. I searched this forum for "array stored procedure" and came up with 9 posts dating back to April 30, 1999. In every one of these posts, people have asked how this can be done, and as yet there has not been any real solution provided. One messy solution is to add another stored proc that takes the array items as scalars and builds a PL/SQL table to pass to the original stored proc.
    I am getting the impression that using arrays for IN/OUT parameters to/from stored procedures is not possible with JDK 1.1. Can it be done with JDK 1.2?
    Isn't there anyone from Oracle that can provide an answer or solution?

    I've searched for a way of passing a rowtype to a stored
    procedure or passing an array to a stored procedure.
    The following example may have some pertinence. It was posted at
    http://www.classicity.com/oracle/htdocs/forums/ClsyForumID124/6.h
    tml#
    I also think that it would be useful to know how best to pas a
    ResultSet or equivalent to a Stored Procedure, if someone has
    more information. The idea is to have symmetry between the way
    data is retrieved from SP's (CURSORS) and supplied to SP's (???
    ARRAY/CURSOR) ?
    "[Example]Example of using JDBC with VARRAYS and REF CURSORs"
    This example shows how to use JDBC with VARRAYS and REF
    CURSORs.
    It also shows use of the PreparedStatement and CallableStatement
    methods.
    The example does the follows:
    1. selects from a table of VARRAYs
    2. inserts into a table of VARRAYs
    3. selects from a table of VARRAYs
    4. calls stored procedure -- parameters <ref cursor, varray>
    In order to test it, you will need to do two things first:
    1) Create related tables and types first. The screipt is given
    below.
    2) Create a package that gets called from JAVA code. The script
    is given below.
    ======================= Step 1 create tables etc. cute here
    ==================
    -- Run this through SQL*PLUS
    drop TABLE varray_table;
    drop TYPE num_varray;
    drop TABLE sec;
    -- create the type
    create TYPE num_varray as VARRAY(10) OF NUMBER(12, 2);
    -- create the table
    create TABLE varray_table (col1 num_varray);
    -- create the sec table
    create table sec (sec_id number(8) not null, sec_grp_id number
    (8) not null,
    company_id number(8) not null);
    insert into sec values (1,200,11);
    insert into sec values (2,1100,22);
    insert into sec values (3,1300,33);
    insert into sec values (4,1800,44);
    ==================== End of step
    1===========================================
    ================== Step 2 create package
    ====================================
    -- Run it through sql*plus
    CREATE OR REPLACE PACKAGE packageA AS
    type sctype is ref cursor return SEC%ROWTYPE;
    procedure get_port_consensus(sc IN OUT sctype, arr IN
    num_varray);
    procedure test_port_consensus(sc IN OUT sctype);
    END packageA;
    CREATE OR REPLACE PACKAGE BODY packageA AS
    procedure test_port_consensus(sc IN OUT sctype)
    IS
    testArr num_varray := num_varray(200, 1100, 1300, 1800);
    BEGIN
    get_port_consensus(sc, testArr);
    END test_port_consensus;
    procedure get_port_consensus(sc IN OUT sctype, arr IN num_varray)
    IS
    BEGIN
    open sc for select * from sec
    where sec_grp_id = arr(1)
    or sec_grp_id = arr(2)
    or sec_grp_id = arr(3)
    or sec_grp_id = arr(4);
    END get_port_consensus;
    END packageA;
    ===================== End of step 2
    ===================================
    ============ JAVA code to test the whole thing
    ========================
    import java.sql.*;
    import oracle.sql.*;
    import oracle.jdbc.oracore.Util;
    import oracle.jdbc.driver.*;
    import java.math.BigDecimal;
    public class ArrayExample
    public static void main (String args<>)
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver
    // Connect to the database
    // You need to put your database name after the @ sign in
    // the connection URL.
    // The example retrieves an varray of type "NUM_VARRAY",
    // materializes the object as an object of type ARRAY.
    // A new ARRAY is then inserted into the database.
    Connection conn =
    DriverManager.getConnection ("jdbc:oracle:oci8:@v81",
    "scott", "tiger");
    // It's faster when auto commit is off
    conn.setAutoCommit (false);
    // Create a Statement
    Statement stmt = conn.createStatement ();
    System.out.println("Querying varray_table");
    ResultSet rs = stmt.executeQuery("SELECT * FROM varray_table");
    showResultSet (rs);
    // now insert a new row
    // create a new ARRAY object
    int elements<> = { 200, 1100, 1300, 1800 };
    ArrayDescriptor desc = ArrayDescriptor.createDescriptor
    ("NUM_VARRAY",conn);
    ARRAY newArray = new ARRAY(desc, conn, elements);
    // prepare statement to be inserted and bind the num_varray type
    System.out.println("PreparedStatement: Inserting into
    varray_table");
    PreparedStatement ps =
    conn.prepareStatement ("insert into varray_table values (?)");
    ((OraclePreparedStatement)ps).setARRAY (1, newArray);
    ps.execute ();
    // query to view our newly inserted row
    System.out.println("Querying varray_table again");
    rs = stmt.executeQuery("SELECT * FROM varray_table");
    showResultSet (rs);
    // prepare a callable statement -- call the stored procedure
    // passing <ref cursor in out, varray in>
    System.out.println("CallableStatement: Calling Stored
    Procedure");
    OracleCallableStatement oraStmt1 =
    (OracleCallableStatement)conn.prepareCall("{ call
    packageA.get_port_consensus(?, ?) }");
    oraStmt1.registerOutParameter(1, OracleTypes.CURSOR);
    oraStmt1.setARRAY(2, newArray);
    oraStmt1.execute();
    rs = (ResultSet)oraStmt1.getObject(1);
    // loop through the result set of the ref cursor and display
    while (rs.next()) {
    System.out.println(rs.getString("sec_grp_id"));
    // Close all the resources
    rs.close();
    ps.close();
    stmt.close();
    oraStmt1.close();
    conn.close();
    public static void showResultSet (ResultSet rs)
    throws SQLException
    int line = 0;
    while (rs.next())
    line++;
    System.out.println("Row "+line+" : ");
    ARRAY array = ((OracleResultSet)rs).getARRAY (1);
    System.out.println ("Array is of type "+array.getSQLTypeName());
    System.out.println ("Array element is of type
    code "+array.getBaseType());
    System.out.println ("Array is of length "+array.length());
    // get Array elements
    BigDecimal<> values = (BigDecimal<>) array.getArray();
    for (int i=0; i<values.length; i++)
    BigDecimal value = (BigDecimal) values;
    System.out.println(">> index "+i+" = "+value.intValue());

  • Problems getting a resultset out of a stored procedure

    We're having a problem getting a resultset out of a stored procedure with JDBC. The third parameter for the procedure is an out REF CURSOR. Connection to the database is fine, we just keep getting the following error when we do the GetCursor(3) statement:
    ORA-00942: table or view does not exist
    We know for definate that something is coming out of the database as we can call it from ODBC without any errors. If anyone's got any ideas as to what's going wrong please let me know!
    The cut-down code follows:
    public class JSMatt extends HttpServlet {
    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, IOException {
    PrintWriter out = resp.getWriter();
    // Load the Oracle JDBC driver
    out.println("Registering driver...");
    Class.forName("oracle.jdbc.driver.OracleDriver");
    // Connect to the DB
    out.println("Connecting to database...");
    Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@computer:db",
    "username", "password");
    // Create a statement using a stored procedure
    out.println("Creating query...");
    OracleCallableStatement st = (OracleCallableStatement)conn.prepareCall ("BEGIN archive.spSrchLanguage (?, ?, ?); END;");
    st.registerOutParameter(3, OracleTypes.CURSOR);
    st.setInt(1, 0);
    st.setInt(2, 12);
    st.execute();
    ResultSet rs = ((OracleCallableStatement)st).getCursor(3);
    null

    Further study of my colleagues issue reveals that the problem only occurs where we are using a synonym for our package even though the user has permissions to run it (and indeed does when using ODBC or OLEDB).
    If we call a procedure in our package which does not return a ref cursor then the procedure is getting called fine (as can be evidenced by the database inserts etc within the procedures).
    Ideally we would like to use a synonym (I like to keep nice clean tidy schemas!) so if anyone knows how to get around it please let us know.
    Regards
    Jason.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Matthew Butt ([email protected]):
    We're having a problem getting a resultset out of a stored procedure with JDBC. The third parameter for the procedure is an out REF CURSOR. Connection to the database is fine, we just keep getting the following error when we do the GetCursor(3) statement:
    ORA-00942: table or view does not exist
    We know for definate that something is coming out of the database as we can call it from ODBC without any errors. If anyone's got any ideas as to what's going wrong please let me know!
    The cut-down code follows:
    public class JSMatt extends HttpServlet {
    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException, IOException {
    PrintWriter out = resp.getWriter();
    // Load the Oracle JDBC driver
    out.println("Registering driver...");
    Class.forName("oracle.jdbc.driver.OracleDriver");
    // Connect to the DB
    out.println("Connecting to database...");
    Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@computer:db",
    "username", "password");
    // Create a statement using a stored procedure
    out.println("Creating query...");
    OracleCallableStatement st = (OracleCallableStatement)conn.prepareCall ("BEGIN archive.spSrchLanguage (?, ?, ?); END;");
    st.registerOutParameter(3, OracleTypes.CURSOR);
    st.setInt(1, 0);
    st.setInt(2, 12);
    st.execute();
    ResultSet rs = ((OracleCallableStatement)st).getCursor(3);
    <HR></BLOCKQUOTE>
    null

  • XML CLOB out from a stored procedure

    I'm using Oracle 8.1.7 and OO4O(Oracle Objects for OLE)
    8.1.7.0.1
    I'm generating an XML string in a CLOB using the XSU in a stored
    procedure.
    I'm then trying to pass the CLOB as an out parameter for that
    procedure to an
    ASP page using OO4O. I get the following error on the line
    where I call the ExecuteSql
    method of the OO4O Database object:
    Error Type:
    Oracle Automation (0x800A01B8)
    OIP-04796: Error in creating object instance
    If anyone can give me a a solution to this or a better way to
    do it I would much appreciate it. I've tried using a function
    as well.
    It does work if the CLOB is pulled from a database field, so I
    think
    the problem lies in the CLOB coming from the getXML method.
    Since I'm
    creating and XML datagram from relational tables, it doesn't
    make much
    sense to save the generated XML to a CLOB field and then load it
    right
    back to pass to the web page.
    Thanks in advance...
    Here's my code for the stored procedure:
    Procedure SP_INI_XML
    (result OUT CLOB)
    IS
    queryCtx SYS.DBMS_XMLQuery.ctxType;
    begin
    queryCtx := SYS.DBMS_XMLQuery.newContext(... SQL
    statement ...);
    SYS.DBMS_XMLQuery.setRowTag(queryCtx,'INI');
    SYS.DBMS_XMLQuery.setRowsetTag(queryCtx,'ROOT');
    SYS.DBMS_XMLQuery.setXSLT(queryCtx, 'http://site/file.xsl');
    result := SYS.DBMS_XMLQuery.getXML(queryCtx);
    SYS.DBMS_XMLQuery.closeContext(queryCtx);
    end;
    Here's my code from the ASP page:
    Set ses = Server.CreateObject("OracleInProcServer.XOraSession")
    Set con = ses.OpenDatabase(DBServer,ConStr,0)
    Const ORATYPE_CLOB = 112
    con.Parameters.Add "str",Null,2,ORATYPE_CLOB
    con.ExecuteSql("begin SP_INI_XML(:str);end;")

    Ah yes I see. Sorry I misunderstood what you were suggesting. I'm currently working on a test script that uses an approach similar to the one you mentioned, but I'm having trouble resolving foreign key relationships with test data.
    I've no access to the tables or anything so it's proving to be a time consuming task!!
    Is it required that all fields are given a value, even if they have a "DEFAULT" defined for them within the procedure. At the moment I'm using a rather cumbersome approach to this:
    i.e.
    With cmmAddRequest
        .ActiveConnection = strConnect
        .CommandType = adCmdText
        .CommandText = strSQL
        .Parameters(0).Direction = adParamInput
        .Parameters(1).Direction = adParamInput
        .Parameters(2).Direction = adParamInput
        .Parameters(3).Direction = adParamOutput
        .Parameters(4).Direction = adParamOutput
        .Parameters(5).Direction = adParamOutput
        .Parameters(0).Value = "COMP"
        .Parameters(1).Value = "FRML"
        .Parameters(2).Value = "1"
        .Execute
        WScript.Echo(.Parameters(5).Value)
    End With

  • Problem with IN OUT parameters whiloe calling procedure from Form 6i

    Hi
    Could some help please? I have the following scenario.
    I am calling a stored procedure from form 6i by pressing a button on the form. Procedure has two IN OUT parameters, and I am passing these two IN OUT parameters and have declared them the way they are declared passed to the procedure. But I get an error when calling that procedure with these IN OUT parameters. the procedure works fine if parameters are IN only. The error says:
    PLS:00363: Expression '1' cannot be used as an assigment target.
    NO matter I pass some value or leave it blank, I get the same error message persistenetly.
    Please help.
    Thanks

    make sure you are calling your procedure with variables as parameters,
    i.e.
          l_v1 := 1 ;
          l_v2 := 'hello world' ;
          your_proc(l_v1, l_v2)
    not
          your_proc(1,'hello world')

  • Get out values from stored procedure

    Hi folks,
    I have need of an aid. I have created this stored procedure:
    CREATE OR REPLACE PROCEDURE ProceduraDiProva (
    p_val1 IN NUMBER DEFAULT 1,
    p_val2 IN NUMBER DEFAULT 1,
    p_val3 OUT NUMBER,
    p_val4 OUT NUMBER)
    AS
    BEGIN
    p_val3 := p_val1 + p_val2;
    p_val4 := 999;
    END ProceduraDiProva;
    I call the procedure into shell script
    $ORACLE_HOME/bin/sqlplus -s user/pwd@oracleid > oracle.log << END
    spool ciccio.txt
    declare
    var a_out number;
    var b_out number;
    begin
    var a_out:=0;
    exec ProceduraDiProva(1, 2, a_out, b_out);
    end;
    spool off;
    exit
    END
    I would know as I make to insert 'a_out' and 'b_out' in a shell variables
    Tanks in advance

    I found an example with windows
    Create a file cmd with;
    FOR /F "usebackq delims=!" %%i IN (`sqlplus -s %usuario%/%pwd%@%ddbb% @1.sql`) DO set xresult=%%i
    echo %xresult%
    And the 1.sql:
    set timing off
    set feedback off
    set pages 0
    select sysdate from dual;
    exit
    ------------------------------------------------------------------------------------------

  • Cannot get OUT parameter from stored procedure

    Hi,
    I am new to stored procedure programming. I wrote a simple java stored procedure as follows:
    package fvt;
    import java.sql.*;
    import java.io.*;
    public class FVTProcedures
    extends COM.ibm.db2.app.StoredProc {
    public void addRecord(int id, String name, int status)
    throws SQLException {
    java.sql.Statement stmt = null;
    java.sql.Connection con = null;
    PrintWriter pw = null;
    try {
    status =3;
    pw = new PrintWriter(new FileWriter("c:/temp/fvtproc.txt"));
    pw.println("starting...");
    // get connection
    con =getConnection();
    pw.println("Got connection");
    stmt = con.createStatement();
    stmt.execute("INSERT INTO cmtest (id, name) values (" + id + ",'"+name+"')");
    pw.println("Inserted the record");
    if (!con.getAutoCommit()) {
    con.commit();
    pw.println("Committed the connection");
    catch (SQLException sqle) {
    pw.println(sqle.getMessage());
    catch (Exception e) {
    pw.println(e.getMessage());
    finally {
    status =2;
    pw.close();
    try {
    if (stmt != null) {
    stmt.close();
    catch (SQLException sqle) {}
    try {
    if (con != null) {
    con.close();
    catch (SQLException sqle) {}
    Then I use the following sql command to create this stored procedure, especially register status as OUT parameter.
    CREATE PROCEDURE addRecord (IN id INT, IN name VARCHAR(20), OUT status INTEGER)
    FENCED LANGUAGE JAVA EXTERNAL NAME 'fvt.FVTProcedures!addRecord' PARAMETER
    STYLE DB2GENERAL
    My java program calling this stored proc is as follows:
    import java.sql.*;
    import javax.sql.*;
    public class CallableStmtTest {
         COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource ds = null;
         public static void main(String args[]) {
              CallableStmtTest dt = new CallableStmtTest();
              try {
                   dt.test();
              } catch (Exception e) {
                   e.printStackTrace(System.out);
         public CallableStmtTest() {
              ds = new COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource();
              ds.setUser("username");
              ds.setPassword("password");
              ds.setDatabaseName("database");
    public void test() {
    java.sql.Connection conn = null;
    CallableStatement cs = null;
    String sql = "CALL ADDRECORD(?, ?, ?)" ;
    try {
    conn = ds.getPooledConnection().getConnection();
    conn.setAutoCommit(false);
    System.out.println("Got the connection");
    cs = conn.prepareCall( sql ) ; /* con is the connection */
    System.out.println("Callable statement is prepared");
    cs.registerOutParameter(3, java.sql.Types.INTEGER);
    cs.setInt(1, 1001 );
    cs.setString(2, "1001");
    cs.execute() ;
    System.out.println("Callable statement is executed, return status: "+cs.getInt(3));
    conn.commit();
    catch(SQLException sqle) {
    sqle.printStackTrace();
    finally {
    try {
    if (cs!=null) {cs.close();}
    catch (SQLException sqle1) {
    try {
    if (conn!=null) {conn.close();}
    catch (SQLException sqle1) {
    However, the out put is always
    Callable statement is executed, return status: 0
    while i expect to be
    Callable statement is executed, return status: 2
    Can anyone tell me what's wrong with that?
    thansk,
    JST

    public void addRecord(int id, String name, int status)
    throws SQLException {
    status =3;In regular java you are never going to see this value (3) outside of that method. Java doesn't work that way.
    So unless java inside the DB works really differently from regular java, you are going to have to pass something else.

  • How to use DATETIME parameters in stored procedure?

    I can not define a variable or parameters
    with data type of DATETIME
    when I define stored procedure using Developer/2000.
    Does Oracle not support DATETIME?
    null

    Chen Honghua (guest) wrote:
    : I can not define a variable or parameters
    : with data type of DATETIME
    : when I define stored procedure using Developer/2000.
    : Does Oracle not support DATETIME?
    Oracle supports DATETIME data type.
    "DATETIME" data type is stored in "DATE" data type.
    if you want to DEFINE "10-Jan-1998 10:20" :
    declare
    dummy_date date:=to_date('10-jan-1998 10:00','DD-MON-YYYY
    HH24:MI');
    BEGIN
    END;
    null

  • Parameters in stored procedure

    If I need to call a stored procedure with 6 input parameters and 6 output parameters, how would I do this? Would it look like this?...
    cstmt = con.prepareCall("{?, ?, ?, ?, ?, ? = CALL MKTDS22B (?, ?, ?, ?, ?, ?)}");
    or this?...
    cstmt = con.prepareCall("(CALL MKTDS22B (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ,?))" );
    Please help! Thanks!

    Version 2 is correct. A parameter to the left of the equals sign is for (the one and only) return code value from the procedure as issued by the return statement.

  • Arrays as out param on stored procedure causes hang

    Hi,
    I would like to be able to use an ARRAY to pass data back from a java stored procedure. Calling the stored procedure using jdbc, the procedure hangs. If I change the out param to a VARCHAR, the procedure works fine (although, of course, the size of the data returned is limited).
    I defined a varray type:
    CREATE TYPE str_array AS VARRAY(100) OF VARCHAR2(255);
    I defined the stored procedure:
    CREATE OR REPLACE PROCEDURE ob_snapshot(symbol VARCHAR2, start_time DATE, end_time DATE, interval NUMBER, depth NUMBER, output_result IN OUT STR_ARRAY)
    AS LANGUAGE JAVA
    NAME 'OBSnapshot.snapshot(java.lang.String, java.sql.Timestamp, java.sql.Timestamp, int, int, oracle.sql.ARRAY[])';
    The execute on the CallableStatement never finshes. Any ideas ?
    Thanks for the help,
    Chris Opler
    null

    I recommend you declare your iterator as follows :
    public class yourApp {
    #sql public static iterator Temp1 (...);
    null

  • CR XI Pass parameters to stored procedure but don't filter returned result set

    I have created a stored procedure that takes a begin date and an end date. The returned resultset is what I want in the report, but CR (as it should) filters the results so that the report shows only those records between the begin and end dates.
    In short, I don't want the parameters to be used to filter the data returned from the stored proc. Is that possible?

    Huh??? You only return data that has been filtered by the SP to CR but you want all of the records?
    Filtering is done Server side with SP's, if CR doesn't get the unfiltered data then you have to change it server side.
    So first suggestion is to remove the parameters from the SP, then CR can filter or not later on but could potentially return a lot of data. Applying filtering client side in CRD coudl take a while to do, depending on what is in the report....
    Don

  • HELP: Can't Pass Parameters w/Stored Procedure as Data Connection

    I'm working on using an existing employment application in PDF format, and I want the form fields to be prepopulated with the user's specific data.
    I'd like is so that when a user clicks a link (like www.mysite.com/empapp/empapp.pdf?UserID=5), a dynamic PDF document will open up and that user's data will be populated inside of the form fields by using that user's "UserID" variable/parameter that was passed in the querystring.
    I've tried a stored procedure that contains the following select statement:
    SELECT * FROM tblEmpApp WHERE UserID = @UserID
    I've also tried entering this select statement manually into the box instead of using a stored procedure without success. When I try to use the stored procedure, I receive this error:
    Stored procedure "spEmpApp" has non-optional parameters.
    How can I set the PDF doc up to populate the form fields based on that passed parameter in the querystring???
    ******************PLEASE HELP!!!******************

    had this same issue.  following works for me.
    -create a dataconnection to the db with a random query to the table.
    -just clone the dataconnection
         oDConn = xfa.sourceSet.DataConnection.clone(1);
    -change the query attribute to the stored procedure
         oDConn.resolveNode("#command").query.select.value = "exec spEmpApp 'parameter'"
    -open the cloned data connection
         oDconn.open();

  • Report is slow and times out based upon stored procedure

    I have a report that runs off the following stored procedure, because i can not join the tables i need to do a union query or a nested query to return the shipments.  any one know how i can speed this up be chaging the stored procedure to use a nested query on the last portion of the query (under union)?
    SELECT DISTINCT
    dbo.INV_BEG_BALANCE_JAN_JUNE_2010.DIVISION               as COMPANY,
    dbo.INV_BEG_BALANCE_JAN_JUNE_2010.SEASON               AS SEASON,
    dbo.INV_BEG_BALANCE_JAN_JUNE_2010.STYLE               as STYLE,
    dbo.INV_BEG_BALANCE_JAN_JUNE_2010.MONTH_END_DATE                            AS ME_DATE,
    dbo.INV_BEG_BALANCE_JAN_JUNE_2010.BEGINNING_BALANCE                          AS BEG_BAL,
    dbo.INV_BEG_BALANCE_JAN_JUNE_2010.CURRENT_COST          AS CRNT_COST,
    dbo.RECVSKU#.RCQTY                         AS REC_QTY,
    0                              AS SHIP_QTY,
    dbo.RECVSKU#.RCDATE                         AS REC_DATE,
    ''                              AS SHIP_DATE
    FROM        
    dbo.INV_BEG_BALANCE_JAN_JUNE_2010 LEFT OUTER JOIN
    dbo.RECVSKU# ON
    dbo.INV_BEG_BALANCE_JAN_JUNE_2010.SEASON = dbo.RECVSKU#.RCSEAS AND
    dbo.INV_BEG_BALANCE_JAN_JUNE_2010.STYLE = dbo.RECVSKU#.RCSTYL AND
    dbo.INV_BEG_BALANCE_JAN_JUNE_2010.DIVISION = dbo.RECVSKU#.RCDIVN
    WHERE    
    (dbo.INV_BEG_BALANCE_JAN_JUNE_2010.MONTH_END_DATE = '20100228')
    AND (dbo.RECVSKU#.RCDATE >= '20100301') AND (dbo.RECVSKU#.RCDATE <= '20100331')
    AND dbo.INV_BEG_BALANCE_JAN_JUNE_2010.DIVISION = 'AAA'
    union
    SELECT
    dbo.SHIPSKU#.SCDIVN                    AS COMPANY,
    dbo.SHIPSKU#.SCSEAS                    AS SEASON,
    dbo.SHIPSKU#.SCSTYL                    AS STYLE,
    ''                                                       AS ME_DATE,
    0                                                  AS BEG_BALE,
    dbo.MITMAS.MMPUPR                                                        AS CRNT_COST,
    0                                                AS REC_QTY,
    dbo.SHIPSKU#.SCQTY                                                     AS SHIP_QTY,
    ''                         AS REC_DATE,
    dbo.SHIPSKU#.SCDATE                                                      AS SHIP_DATE
    FROM dbo.SHIPSKU#
    LEFT OUTER JOIN dbo.MITMAS ON dbo.SHIPSKU#.SCSKU# = dbo.MITMAS.MMITNO
    WHERE dbo.SHIPSKU#.SCDATE>='20100301' AND dbo.SHIPSKU#.SCDATE <='20100331'
    AND  dbo.SHIPSKU#.SCDIVN = 'AAA'

    hi Sharon,
    if you use a "UNION ALL" instead of a union does that give you better performance?
    jamie

  • Not prompting for the parameters of stored procedures while running

    Hi All,
    I have a stored proc which takes in 3 parameters and execute a copy of a record in a table based on the 3 parameters which I pass in.
    When I use the proc in crystal reports (Crystal Reports 2008), it is not prompting for the parameter values if we execute the report directly. It's prompting the values only when I do 'Veriyf Database' from the menu. Why is it not prompting for values when executing directly. Am I missing anything here?
    Also, I have a C# .net project which uses the report and take in input parameters. Even there, previously, I used to call the VerifyDatabase () first and then the SetParameterValues () which was working fine for regular expressions. But for this report (which uses stored procedure), it is not giving the desired output (copying data), even though the report doesn't fail to run. But when I changed the order of the call to have SetParameterValues () before the call to VerifyDatabase (), it works fine (copies the data for the given input parameters).
    Please let me know what is missing here? Is the order of the call to VerifyDatabase () and SetParameterValues () matters? If so, why is it working for regular expressions and not for stored procs?
    Please clarify.
    Thanks,
    Siva.

    I recommend posting this to the Crystal Reports Design forum. As I read it:
    When I use the proc in crystal reports (Crystal Reports 2008), it is not prompting for the parameter values if we execute
    the report directly. It's prompting the values only when I do 'Verify Database' from the menu. Why is it not prompting
    for values when executing directly. Am I missing anything here?
    The issue is in the CR designer 1st. So it needs to be resolved there before moving on to the CR SDK in .NET.
    Link to CR design forum:
    SAP Crystal Reports, version for Visual Studio
    Ludek

Maybe you are looking for

  • SD video on an HD monitor

    I am thinking about getting the 23" HD monitor. I use FCP and am still working in SD Video. Clients haven't moved up to HD yet. How crappy will the SD video I work with in my projects look on this monitor?

  • Unable to view photos in Explorer on Desktop

    I just noticed that I can no longer see thumbnails for the photos in my Pictures library, or the Video library, they just show up as the generic picture/video icon. The font used also seems non-standard. I'm not sure where to start looking to fix thi

  • Mouse Integration Incompatible w/ SMS 2003 Advanced Client

    Ref Setup: http://wikis.sun.com/display/VDI3/Getting+Started+-VDIDemo Ref Bugs: http://www.virtualbox.org/ticket/414 http://www.virtualbox.org/ticket/1324 Ref Docs: http://support.microsoft.com/kb/933986 http://technet.microsoft.com/en-us/sms/bb67678

  • KeyListener for a command line application

    Hi, I'm currently writing a small command line application aimed at interacting with a database. I would like to implement features such as an automatic completion of the names with the TAB key. My problem is that the objects that sends KeyEvent are

  • NOD & LINA records - IDoc data

    Hi Experts, What is mean by NOD & LINA records? One of my spec says "before sending the Idocs validation is done For NOD and LINA records and if any of the mandatory fields are missing then it is printed as an error report". thanks Dany