Omiting parameters for stored procs

Post Author: lihaze
CA Forum: Data Connectivity and SQL
Hi - I hope that this is a straightforward one..  I have a number of params in a shared stored proc (they do default to NULL, but the app that I am using to call Crystal firstly cannot pass in a NULL value(!!!), and also always asks for the same no. of params that are in the creport. So, I am using Crystal 8.5, I dont even want these params to be requested. How can I make sure that they arent requested in Crystal?thanks

Post Author: yangster
CA Forum: Data Connectivity and SQL
to actually pass a null value using crystal reports you will have to use crystal 2008as this isn't what you are after the alternative would be to in your report edit the parameter from the stored procedureput in a value, set the default value to that value and change allow custom value to falsethis will push the default value to the parameter every single time the report is run so you will not be prompted for the parameter value anymore

Similar Messages

  • Is it possible to pass array of strings as input parameters for stored proc

    Dear All,
    I wrote a Stored Procedure for my crystal report. now i got a modification.
    one of the parameters 'profit_center' should be modified so that it is capable to take multiple values.
    now when i run report crystal report collects more than one values for parameter profit_center and sends it as input parameter to stored procedure all at a time.
    the only way to handle this situation is the input parameter for stored procedure 'profit_center' should be able to take array of values and i have a filter gl.anal_to = '{?profit_center}'. this filter should also be modified to be good for array of values.
    Please Help.

    Or you can use sys.ODCIVarchar2List
    SQL> create or replace procedure print_name( In_Array sys.ODCIVarchar2List)
        is
        begin
                for c in ( select * from table(In_Array) )
                loop
                        dbms_output.put_line(c.column_value);
                end loop ;
        end ;
    Procedure created.
    SQL>
    SQL> exec print_name(sys.ODCIVarchar2List('ALLEN','RICHARD','KING')) ;
    ALLEN
    RICHARD
    KING
    PL/SQL procedure successfully completed.SS

  • Using Statement rather than CallableStatement for stored proc execution

    Cleary, if you need to extract output parameters from a stored procedure, then you must use a CallableStatement to execute it. However, if your stored procedure just returns a basic ResultSet, or performs a database update, is there any penalty to using a regular Statement to execute the stored procedure?
    For example -
    String sql = "exec testprocedure 'param1' 'param2'";
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery( sql );
    vs.
    CallableStatement cs = conn.prepareCall( "{call testprocedure(?,?)}" );
    cs.setString( 1, "param1" );
    cs.setString( 2, "param2" );
    ResultSet rs = cs.executeQuery();
    Any thoughts?

    Any thoughts?You would have to look at the actual driver code for a sure answer.
    But for any real database (which a stored proc suggests) I doubt there would be any difference at all. It would resolve to the same call.

  • 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());

  • SQL Statement as Parameter for Stored Proc

    This works fine in SQL script, but doesn't work when converting the script to a sp.  It doesn't like how I've defined the @PeriodEndDate parameter.  How do I set the variable to the results of a SQL statement?
    CREATE PROCEDURE usp_ARAging 
    -- Add the parameters for the stored procedure here
    @FiscalYear int = 2014, 
    @FiscalPeriod int = 5,
    @PeriodEndDate date = (SELECT MAX(JEDate) FROM ERPSQL01.EpicorNamg905.Accounting.Dim_JEDate
    WHERE FiscalYear = @FiscalYear
    AND FiscalMonth = @FiscalPeriod)
    Kirk P.

    Let's start over.  The default value of a procedure argument is a "suggestion" - a value to be used when it is not provided by the caller.  So is your goal to allow the user to supply any date, not just the one that coincides with the
    fiscal year and period values?  IF not, then it should not be a parameter and the value should be determined by the code inside the stored procedure. 
    However, if your goal is to allow any value, then you must follow the rules for specifying an appropriate default and those rules are very restrictive.  You cannot use a query nor can you refer to other parameters.  The typical approach is to use
    a "marker" value which the caller uses to indicate that it wants to use the true "default" value which you would then determine inside your stored procedure.  Often a value of NULL is used; in your procedure the code checks this parameter
    for a null value and, if found, assigns it the value you used in your query above.
    And while we're at it, you should code defensively and check that the set of values supplied as parameters are consistent with each other and with the logic that depends on them.  For example, presumably the period argument should be between 1 and 12
    (and not null).  I suggest you reconsider the use of integers since the domain of these values FAR EXCEEDS that allowed for years and months for most business purposes.

  • ADO Recordsets as IN parameters to stored procs

    Is there anyone who knows whether we can pass one (or more)
    recordsets to an oracle stored procedure as input parameters.
    Since it can be done for OUT parameters, I thought it may be
    done with IN too.
    If anyone knows the way, or knows that it is not possible, I
    would appreciate to hear it
    Thanx

    Yep,
    I looking for the same.Did you get any joy?

  • URGENT: CLOB as output parameter for stored proc

    HELP
    I am unable to execute a stored procedure which has a CLOB defined as an output parameter from my Java code. It executes just fine from the SQL Plus promt.
    When I try to run it through JDBC I get a PLS-00306 error.
    I am using the Thin JDBC driver. When I try to compile using the OCI driver, I get class not found compile errors trying to import oracle.sql.*.
    Thanks!
    Donna J. Polk

    The oracle.sql.* classes are part of the Oracle JDBC Driver.
    Update your CLASSPATH variable to include $ORACLE_HOME/jdbc/lib/classes12_01.zip for JDK 1.2 or $ORACLE_HOME/jdbc/lib/classes111.zip for JDK 1.1.x

  • 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

  • BizTalk Stored Proce-passing XML as one of the Input parameter and String as another parameter

    I have a requirement in BizTalk that
    - I will receive XML from Source and i need to submit this XML data and two other string parameters in  SQL storeprocedure  as a parameters and submit data
    Ex: My_SP(myID Integer INPUT,myXML xml Input,mystring OUT)
    Could you please help me how call storeprocedure and submit multiple parameters in BizTalk.

    you can execute stored procedure by generating schemas from WCF-SQL Adapter.
    for passing parameters you will have to do the mapping to the Generated schema for Stored proc.
    I would suggest to do this in Message Assignment shape, there you can easily assign all the parameters.
    Integer and String parameters can be assigned from normal variables and XML parameter can be inserted as suggested by Abhishek-
    xmldoc=requestMsg;
    varOuterstring=xmldoc.Outerxml.Tostring();
    Please refer the below article.
    https://www.packtpub.com/books/content/new-soa-capabilities-biztalk-server-2009-wcf-sql-server-adapter
    http://msdn.microsoft.com/en-us/library/dd787968.aspx
    Thanks,
    Prashant
    Please mark this post accordingly if it answers your query or is helpful.

  • Perl and stored proc question

    Hello,
    I have used ASP w/ many SQL Server stored procs before and many Oracle stored procs with Java before, but I have yet to embark on calling stored procs from Perl.
    My current insert has been like this:
    my $dbh = DBIConnect->connect;     
    my $query1;
    $query1 = "INSERT into DEFAULT_PROJECT (NAME, EMAIL, LOCATION,PHONE,MGRNAME,MGREMAIL,"
        ."PROJNAME,PROJ_LOC,SPON_DEPT,SPON_BUS,PROJ_TYPE)
    ."values (?,?,?,?,?,?,?,?,?,?,?);"But am looking to replicate an equivalent call to an SP. ok, I've created my multi-table insert in SQL Plus, in PL/SQL, and it's just fine, no errors.
    Now I need to make the call.
    I've seen a few different things, including the use of DBIx like
    DBIx::ProcedureCall qw(sysdate);
    I've also seen something like
      $csr =  $dbh->prepare(q{
        BEGIN
          DEFPROJ_FORM_INSERTION;
        END;
       $csr->execute;I'm a bit confused having tried to shake down the CPAN board for a while with little luck.
    Anyone out there know how that call might look or go, given the supplied parameters and stored proc. name?
    I'd assume I'd be assigning the parameterized values much like I am now.
    Can any Perl/Oracle users out there shed any light on this?
    Thanks!

    alright, so I could not get that to work, but just to validate the insert statement I tried to alter it from an SP to a normal dynamic insert SQL statement.
    I get an Oracle error citing
    errERROR: Could not execute SQL! Error: ORA-00911: invalid character (DBD ERROR: OCIStmtExecute)
    DBI ERROR: ORA-00911: invalid character (DBD ERROR: OCIStmtExecute),Maybe I'm overlooking something simple. Anyone see anything out of place that pertains to the SQL statement?
    I think I have input it in a rather manageable, and easy to read block below:
    INSERT ALL
    INTO DEFAULT_PROJECT_USER
    (DEFPROJ_ID,DEFPROJ_ID_LTR,NAME,EMAIL,LOCATION,PHONE,MGRNAME,MGREMAIL,PROJNAME,PROJ_LOC, SPON_DEPT,SPON_BUS,PROJ_TYPE,REG_LEGAL,NETCRED_LOSS, EXPENSE_REDUC_CKB, STRAT_GOALS,AUDIT_COMPL,REV_GEN,CACS,CUSTOMIT,CUST_IMPACT,CALL_MGT,CALL_TRACK,
    CITILINK,DESKTOP,DIALER,DRI,ENGINEER,IMAGING,IPDT,MAINFR,MISC_OTHER,MORTSERV,MORTWEB,NON_MORTSERV,ORIG_PLAT,QUAL_MAP,DATAWARE_REPTS,SERV_APP_VDR,SOUTHBEND,WEB_SVCG,PROBLEM_RESOLVE,EXIST_PROC,BUS_OBJECTIVE,
    PENDING_PROJ,IMPACT_AREAS,REGULATORY_COMPLY,COMPLY_DEADLINE,SUB_DATE,EXPENSE_REDUCTION_TEXT,PRIORITY_RATING,ADDL_COMMENTS,PROJ_TYPE_OTHER,OTHER_EXPL_IT)
    values (defproj_user_seq.nextval,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,to_date(?,'YYYY-MM-DD HH:MI:SS'),SYSDATE,?,?,?,?,?)
    INTO DEFAULT_PROJECT_PROJMGR
    (DEFPROJ_ID,PROJ_MGR,STATUS,IT_PROJ_TYPE,IT_PROJNUMBER,FUNC_SPECS,FUNC_SPECS_DT,FUNC_SPECS_APPR_DT,BRD_APPROVED,BRD_APPROVED_DT,UAT_STARTDT,UAT_ENDDT,TESTER,RELEASE_DT, TARGETED_RELEASE_DT,BENEFIT_AMT,BENEFIT_CMTS,IT_LEVEL,IT_HOURS,FTES_SAVED,NUM_FTES,PROJQUE1,PROJQUE2,ACTUALCBA)
    VALUES (defproj_user_seq.nextval,NULL, NULL, NULL, NULL,NULL, NULL, NULL, NULL,NULL, NULL, NULL,NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,NULL, NULL,NULL,NULL)
    INTO DEFAULT_PROJECT_QA
    (DEFPROJ_ID,TERM,DEFINITION,BUS_NEED,CUST_IMPACT,CONTACT_NAME,IMPACT,IMPACT_PROCESS,IMPACT_DESC,PROCESS_LOC,PROJ_SCHED,PROJ_JUSTIF,IMPL_DATE,PROJ_EXPL,
    PROJ_TYPE,PROJ_JUST_MIT,PROJ_OWNER,PROJ_DATE_STATUS)
    VALUES (defproj_user_seq.nextval,NULL, NULL, NULL, NULL,NULL, NULL, NULL, NULL,NULL, NULL, NULL, NULL, NULL,NULL, NULL,NULL,NULL)
    SELECT object_name AS DEFPROJ_ID_LTR FROM all_objects where rownum <= 1;what could be leading to an invalid character? The error doesn't show which line.
    Thanks, but NEVER MIND...I found it - it's stupid perl! As opposed to a good language (Java).
    It balks at the extra semicolon, unlike Java would.
    Oh, and why am I using Perl you ask? Other than the "yeah, good question response", it's a long story, but suffice to say they don't allow for our UNIX server to be used with Java, just Perl. : (
    I do use Java a good amount here, but sometimes we're bound to crap on another planet where it just isn't an option for the server on which we use Java!
    Maybe someday! : )
    Message was edited by:
    user515689

  • Crystal crashes when add new parameters to a stored proc in a subreport

    This one has been driving me nuts so any help much appreciated...
    I have a stored procedure (Oracle 9i) that is used as the datasource for a subreport (needs to be in the subreport as I need to pass multi-value parameters to the proc - something I've done in numerous other procs/reports).  All of the parameters from the proc are linked to data/parameters on the main report.
    The report works fine at the moment. 
    I need to add three new parameters to the proc with an If statement on each one to run various bits of code depending on what is passed in.  This is where the trouble starts.
    The proc works.
    If I create a main report based on the new proc, it works.
    If I create a subreport based on the proc and DON'T link it to the main report, it works.
    If I create a subreport based on the proc and DO link it to the main report, Crystal crashes with no explanation (just that painful error that apologies for the inconvenience).  It is not all the parameters that cause this problem - it's not even restricted to just the new parameters or even just to ones that are used in the IF statements.
    This is not the first proc to do this to me - just the first one where the new functionality was too critical to strip out for now.
    I have been trawling the net and trying all sorts of things for days so I am hoping someone out there has a suggestion!
    Versions: Oracle 9i, Crystal Reports 11.0.0.1994

    Hi Daniel,
    Starting from the basics, after you've inserted the subreport don't link it yet.  Edit the subreport and verify the database.  Once it's verified, try linking the reports and adding a parameter. 
    Verify the linking you are using.  I've seen where the field from the main report was passing invalid or coruupted data and caused the subreport to die a horrifying death. 
    Good luck,
    Brian

  • Stored proc to accept parameters at prompt

    How do you create a stored proc in SQL so that when run in desk you can input parameters?
    I have a simple stored proc but when I create in deski always get an error saying that it expects '@DateStart'.
    here is the sproc ive used:
    CREATE  Procedure [dbo].[sp_redempt](@DateStart Datetime,@DateEnd Datetime)  AS  SELECT *
    FROM redempt             
    WHERE planners.office = 'abc'
    AND ProcessDate >= @DateStart and ProcessDate <= @DateEnd
    -- running it in SQL ent mgr
    exec dbo.sp_NCLredempt '01 february 2011', '28 february 2011';
    can you help with the syntax I use or specify a simple stored proc using the adventure works DB that will prompt for a parameter in deski?
    BO Edge XI 3.0
    App server: MS Win2003 Server Standard SP2
    DB server: MS Win2003 Server Standard SP2
    DB on DB server: SQL 2005

    Hi,
    this is not the best place to post this but you may try the SQL Server forums from Microsoft.
    Might  be an issue in your parameter type definition. What you can do is in
    SQL Server Management Studio, go to the stored procedures (programability) under AdventureWorks database, and Right click -> Script Stored Procedure As -> CREATE to -> New Query Editor Window. Then there you will able to see the syntax how it's used.
    You can run one sample procedure in Deski. In Designer create a secure connection to AdventureWorks database. Then create a Deski report based on the "uspGetManagerEmployees" procedure and you can use MnagerID  6 when you run it. You will get results.

  • Stored proc parameters referencing in code

    Hi,
    Quick question ...
    I want my stored proc to accept two parameters : a source table name and a destination table name. The stored proc's goal is to update the destingation table with data in the source table.
    Here is my code :
    CREATE OR REPLACE PROCEDURE UPDATE_FPSYNTHESE (
    sourcetable IN VARCHAR2,
    targettable IN VARCHAR2
    IS
    BEGIN
    INSERT INTO targettable (SELECT * FROM sourcetable WHERE id NOT IN (SELECT id FROM targettable));
    UPDATE targettable SET name = (select name from sourcetable where targettable.id = sourcetable.id);
    END;
    Here's when I want to create it :
    Errors for PROCEDURE UPDATE_FPSYNTHESE:
    LINE/COL ERROR
    10/1 PL/SQL: SQL Statement ignored
    10/40 PL/SQL: ORA-00942: table or view does not exist
    11/1 PL/SQL: SQL Statement ignored
    11/8 PL/SQL: ORA-00942: table or view does not exist
    Warning: Procedure created with compilation errors.
    It doesn't seem to dereference the parameters ...
    what am I doing wrong ?
    Thanks in advance,
    Best regards,
    Steve

    If the source and target tables must be dynamic, you would have to use dynamic SQL
    CREATE OR REPLACE PROCEDURE update_fpsynthese (
      sourcetable IN VARCHAR2,
      targettable IN VARCHAR2 )
    AS
      sqlStmt VARCHAR2(4000);
    BEGIN
      sqlStmt := 'INSERT INTO ' || targettable ||
                 ' (SELECT * ' ||
                 '    FROM ' || sourcetable ||
                 '   WHERE id NOT IN (SELECT id ' ||
                 '                      FROM ' || targettable || '))';
      EXECUTE IMMEDIATE sqlStmt;
    END;Since you are building up strings and executing them, you'll also have to worry about things like SQL injection attacks. You also lose compile-time syntax checking and generally complicate your life from a development & maintenance perspective. Are there really that many tables that you need to do this procedure with?
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Error when executing statement for table/stored proc  DB2 - Data Truncation

    Hi,
      I have one call sp in XI with n parameters int and two parameters out.
       well, to implement the interface gives the following error
    com.sap.aii.af.ra.ms.api.DeliveryException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'SPSAPAR9' (structure 'Statement'): java.sql.SQLException: The number of parameter values set or registered does not match the number of parameters
    Thanks for your help
    Ximena
    Edited by: Ximena Gonzalez on Feb 19, 2008 11:50 AM
    Edited by: Ximena Gonzalez on Feb 20, 2008 12:17 PM

    My Error is change
    Error while parsing or executing XML-SQL document: Error processing request in sax parser: Error when executing statement for table/stored proc. 'SAPPRG.SPSAPAR9' (structure 'Statement'): java.sql.DataTruncation: Data truncation
    but de change DT SP
    <?xml version="1.0" encoding="UTF-8" ?>
    <ns1:AlistReqDet2_MT xmlns:ns1="urn:proxl:tmuc:proxl01:AlistReqItems">
    <Statement>
    <SPSAPAR9 action="EXECUTE">
      <table>SAPPRG.SPSAPAR9</table>
      <ISAPNU1 isInput="TRUE" type="STRING">0080000353</ISAPNU1>
      <ISAPEM1 isInput="TRUE" type="STRING">'LU'</ISAPEM1>
      <ISAPC05 isInput="TRUE" type="STRING">15353</ISAPC05>
      <ISAPSEC isInput="TRUE" type="STRING">10</ISAPSEC>
      <ISAPLOT isInput="TRUE" type="STRING">'lats'</ISAPLOT>
      <ISAPCA1 isInput="TRUE" type="STRING">10</ISAPCA1>
      <ISAPCA2 isInput="TRUE" type="STRING">10</ISAPCA2>
      <ISAPKIL isInput="TRUE" type="STRING">10</ISAPKIL>
      <ISAPES1 isInput="TRUE" type="STRING">'T'</ISAPES1>
      <ISAPSW isOutput="TRUE" type="STRING" />
      </SPSAPAR9>
      </Statement>
      </ns1:AlistReqDet2_MT>

  • ** How to use TO_DATE function in Stored Proc. for JDBC in ABAP-XSL mapping

    Hi friends,
    I use ABAP-XSL mapping to insert records in Oracle table. My Sender is File and receiver is JDBC. We use Oracle 10g database. All fields in table are VARCHAR2 except one field; this is having type 'DATE'.
    I use Stored procedure to update the records in table. I have converted my string into date using the Oracle TO_DATE function. But, when I use this format, it throws an error in the Receiver CC. (But, the message is processed successfully in SXMB_MONI).
    The input format I formed like below:
    <X_EMP_START_DT hasQuot="No" isInput="1" type="DATE">
    Value in Payload is like below.
    <X_EMP_START_DT hasQuot="No" isInput="1" type="DATE">TO_DATE('18-11-1991','DD-MM-YYYY')</X_EMP_START_DT>
    Error in CC comes as below:
    Error processing request in sax parser: Error when executing statement for table/stored proc. 'SP_EMP_DETAILS' (structure 'STATEMENT'): java.lang.NumberFormatException: For input string: "TO_DATE('18"
    Friends, I have tried, but unable to find the correct solution to insert.
    Kindly help me to solve this issue.
    Kind Regards,
    Jegathees P.
    (But, the same is working fine if we use direct method in ABAP-XSL ie. not thru Stored Procedure)

    Hi Sinha,
    Thanks for your reply.
    I used the syntax
    <xsl:call-template name="date:format-date">
       <xsl:with-param name="date-time" select="string" />
       <xsl:with-param name="pattern" select="string" />
    </xsl:call-template>
    in my Abap XSL.  But, its not working correctly. The problem is 'href' function to import "date.xsl" in my XSLT is not able to do that. The system throws an error. Moreover, it is not able to write the command 'extension-element-prefixes' in my <xsl:stylesheet namespace>
    May be I am not able to understand how to use this.
    Anyway, I solved this problem by handling date conversion inside Oracle Stored Procedure. Now, its working fine.
    Thank you.

Maybe you are looking for

  • 2.1 review with itunes 8 update for all

    I initially had addressed the international font issue that the new itunes was having. Apart from that, the addition of the genius tab along with minor improvements here and there seems to make the new itunes 8 likable. Now, for all iphone 3G users.

  • DBMS_METADAT.get_ddl

    Hello every one, Does any one know how to handel if there are dependancy on the table, When we run this and if there are foregin key primary key relation ship between two tables then in the scipt the table with foregien key might come before pk table

  • Formatting cells vertically?

    HI all- In Excel I can easily format a call so the text reads vertically (or even at any angle!) - Is this possible in Numbers? I've played around with settings and can't see an easy way - am I missing something? Thanks, Andy

  • Cryopid compiling issues

    Hello, I was trying to compile cryopid (http://sourceforge.net/projects/cryopid2/) and got stuck on this error, that I'm not sure if it is an Arch or an developer issue: common.c: In function 'myfork': common.c:15:12: error: '__NR_fork' undeclared (f

  • Lumia 928 LTE/WiFi issues

    I don't know if anyone else is having these problems, but it appears that my 928 only wants to connect to data over LTE unless I turn off the Data Connection in "Cellular" settings or I go into airplane mode with WiFi enabled. While this would be a t