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?

Similar Messages

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

  • 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

  • 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

  • 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

  • Clearing Oracle Parameters to call diferent stored procs

    Sub Main
    Do While i < 3
    make_excel(i)
    i = i + 1
    Loop
    end Sub
    Sub make_excel(ByVal array As Integer)
    objCmd.Parameters.Add(New OracleParameter("p_cursor", OracleType.Cursor)).Direction = ParameterDirection.Output
    end Sub
    objCmd.Parameters.Clear()
    objCmd.Parameters.Remove("p_cursor")

    I agree with you. I was looking into mod_plsql, but it turns out that their development standards include not using Oracle HTTP server. The whole reason why they want to be able to execute a stored proc based on what is specified in an XML doc is that they want to avoid having to change their middle-tier configurations anytime a new stored proc or a change in stored proc parameters is made. I'm not familiar with what all is involved with .NET and the middle-tier, but supposedly this way, they can specify any stored procedure name and its parameters in an XML file. The XML is then suppose to be passed on to an Oracle stored procedure which will parse the XML and dynamically execute the stored procedure that was specified in the XML.
    Here is an example of the XML:
    '<Root>
      <PackageName>TEST_PKG</PackageName>
      <ProcedureName>TEST_PROC</ProcedureName>
        <Parameters> 
        <Parameter>
            <Name>EmpID</Name>
            <Value>12345</Value>
        </Parameter>
        <Parameter>
            <Name>Org</Name>
            <Value>ABC</Value>
        </Parameter>
        </Parameters>
    </Root>I basically need to parse out the pkg/proc names:
      SELECT t.COLUMN_VALUE.extract('//PackageName/text()').getstringval() PkgName,
             t.COLUMN_VALUE.extract('//ProcedureName/text()').getstringval() ProcName
         INTO v_pkg_name, v_proc_name
         FROM TABLE(xmlsequence(XMLTYPE(v_XML_input) .extract('/Root'))) t;...and then execute the procedure:
        EXECUTE IMMEDIATE 'BEGIN '||v_pkg_name||'.'||v_proc_name||'(:a, :b, :c); END;'
          using in v_in_param1, v_in_param2, out v_XML_output;The problem is that this approach is very complicated since there can be any number of IN/OUT parameters and of various datatypes. I would have to create all kinds of possible bind variables!

  • 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

  • How to pass XMLType as parameters to Java stored procs ?

    How to pass XMLType as parameters to Java stored procs ?
    ORA-00932: inconsistent datatypes: expected an IN argument at position 1 that is an instance of an Oracle type convertible to an instance of a user defined Java class got an Oracle type that could not be converted to a java class
    Java stored proc -->
    CREATE or replace FUNCTION testJavaStoredProcMerge( entity xmltype,event xmltype ) RETURN VARCHAR2 AS LANGUAGE JAVA
    NAME 'XDBMergeOp.merge(org.w3c.dom.Document,org.w3c.dom.Document) return java.lang.String';
    PL/SQL -->
    declare
    theQuote VARCHAR2(50);
    entity xmltype;
    event xmltype;
    begin
    entity := xmltype('<Quote><Fields><Field1>f1</Field1></Fields></Quote>');
    event := xmltype('<Quote><Fields><Field2>f2</Field2></Fields></Quote>');
    theQuote := testJavaStoredProcMerge(entity,event);
    dbms_output.put_line(theQuote);
    end;
    Java class -->
    public class XDBMergeOp {
    public static String merge(Document entity, Document event) throws Exception {
    return ...
    Thanks in advance.

    I think you'll need to use XMLType and then extract the DOM inside java..
    create or replace package SAXLOADER
    as
      procedure LOAD(P_PARAMETERS XMLTYPE, P_DATASOURCE BFILE);
    end;
    create or replace package body SAXLOADER
    as
    procedure LOAD(P_PARAMETERS XMLTYPE, P_DATASOURCE BFILE)
    AS
    LANGUAGE JAVA
    NAME 'com.oracle.st.xmldb.pm.saxLoader.SaxProcessor.saxLoader ( oracle.xdb.XMLType, oracle.sql.BFILE)';
    end;
      public static void saxLoader(XMLType parameterSettings, BFILE dataSource)
      throws Exception {
        Document parameters = parameterSettings.getDocument();
        SaxProcessor app = new SaxProcessor(parameters);
        app.processXMLFile(dataSource);
      Edited by: mdrake on Apr 6, 2009 11:28 AM

  • Updatable ADO recordset returned by a stored procedure

    I am trying to have an updatable ADO recordset returned by a stored procedure.
    However, LockType for this recordset is always adLockReadOnly.
    What needs to be done to have LockType changed?
    I am using the following simplified example from Oracle doc. According to Oracle® Provider for OLE DB Developer's Guide 10g Release 2,
    the following ADO code sample sets the Updatability property on a command object to allow insert, delete, and update operations on the rowset object.
    Dim Cmd As New ADODB.Command
    Dim Rst As New ADODB.Recordset
    Dim Con As New ADODB.Connection
    Cmd.ActiveConnection = Con
    Cmd.CommandText = "SELECT * FROM emp"
    Cmd.CommandType = adCmdText
    cmd.Properties("IRowsetChange") = TRUE
    Cmd.Properties("Updatability") = 7
    ' creates an updatable rowset
    Set Rst = cmd.ExecuteHowever, the result is not updatable. Can you please advise.

    Returning a REF CURSOR is certainly the easiest of the options, particularly if you're trying to use ADO. Without doing something really klunky, all your options are going to result in read-only result sets.
    Assuming you have a procedure-based interface to your data, the easiest option is generally to do your own updates by explicitly calling the appropriate stored procedures.
    As a bit of an aside, in order to offer updatable result sets, the ODBC/ OLE DB/ etc provider generally has to do something along the lines of
    1) Take the SQL statement you pass in
    2) Modify it to select the ROWID in addition to the other columns you're selecting
    3) Store the ROWID internally and use that as a key to figure out which row to update
    Once you eliminate the ability of the client to manipulate the query, you've pretty well eliminated the ability of the driver to implement generic APIs for updates. The client at that point has no idea which row(s) in which table(s) a particular value is coming from, so it has no idea how to do an update. You generally have to provide that knowledge by coding explicit updates.
    Justin

  • Stored proc parameters not getting populated via code in prod environment

    Hi,
    I have a report created in Crystal developer 2008 SP1. The reportt uses a stored procedure as data source. The stored procedure expects a paramater, @Company, to only return data for that specific company. The report then further has a dynamic parameter which allows to filter by location. This dynamic parameter will therefore only display a list of locations for that specific company to choose from.
    I have a website where users from different companies can log in and view reports based on their company. I use VS2005 to set the @Company parameter programatically (depending on the company of the logged in user). And then the user manually selects the location.
    My problem is all of this works 100% on my dev machine (Win XP SP3, Crystal Developer 2008 SP1, VS2005, IIS5) but as soon as i deploy to the server (Windows Server 2003, Crystal 2008 SP2 Runtime installed, IIS6) the stored procedure's parameter, @Company, are no longer auto populated. It keeps giving a parameter box asking for the @Company value.
    Also it is only for parameters of stored procedures or SQL commands that this happens.
    I have no idea why this happens. Any ideas? I've tried on 2 different production machines (both running Win2003, IIS6). And also on two XP dev machines. On dev it works 100%, but on prod - no luck.
    Thanx

    I've actually solved this. But it's weird.
    I had to install the Crystal Reports designer onto the server. Then everything works fine.
    So it seems the the issue comes in with running the full version / redist version SDK files....
    Is this supposed to happen?

  • Oracle Packages/Stored Proc and VB

    Hello,
    I have a new assignment that I have to start at the client site ASAP. The client wants all the Sql in Oracle Stored Procs/Packages and VB being the front end. I am used to embedding my sql statements in my VB apps and connecting through ADO's but the client does not want embedded sql statements. My question is this, when I make a connection, in accessing the cursor, do I have to loop through the cursor and store the data in an ADO recordset or do I have to connect to the cursor and manipulate the data directly? Please give example.
    The DB is Oracle 9i
    Thanks

    You are doing the right thing, there are examples of how to process result sets from stored procedures, including ASP/ADO at Asktom here

  • Calling 9iLite Stored Procs via ODBC from C/C++

    Hi all,
    The Oracle 9i Lite documentation seems to offer contradictory advice on calling stored procedures over ODBC using C/C++.
    Page 2-11 of Oracle9i Lite "Developer's Guide for Java" (pdf) states "Oracle Lite does not support the SQL CALL statement for invoking stored procedures". Page 2-23 of the same document states "to execute a stored procedure....use the following CALL statement".
    Does anyone know what the correct method is? CALL does not work for me, but I don't know if it's a coding error, or whether I need to invoke the SP a different way.
    thanks for any help you can give,
    Owen.

    Since Mr. Tamashunas's question began elsewhere, I'll give some background for others. Mr. Tamashunas has an ASP (using ADO) using the following code:
    Oracle Package / Proc:
    CREATE OR REPLACE PACKAGE BODY UserInfo
    AS
    PROCEDURE sp_getUsers (
    p_errcode out NUMBER,
    p_errdesc out VARCHAR2,
    iCurs in out tCurs)
    IS
    BEGIN
    p_errcode := 0;
    OPEN iCurs for Select * from naowner.users;
    EXCEPTION
    When others then
    p_errcode := SQLCODE;
    p_errdesc := SQLERRM;
    end sp_getUsers;
    END; -- package body
    ASP code:
    strConn = Session("dbConnStr")
    cnnOracle.Open strConn
    'Creates a command object.
    Set cmdPackage = Server.CreateObject("ADODB.Command")
    Set cmdPackage.ActiveConnection = cnnOracle
    cmdPackage.CommandType = adCmdStoredProc
    cmdPackage.CommandText = "UserInfo.sp_getUsers"
    'cmdStoredProc.CommandText = "{call UserInfo.sp_addUser(?,?,?,?)}"
    cmdStoredProc.Parameters.Append
    cmdStoredProc.CreateParameter("errcode",adInteger,adParamOutput)
    cmdStoredProc.Parameters.Append
    cmdStoredProc.CreateParameter("errdesc",adVarChar,adParamOutput,1000)
    cmdStoredProc.Execute
    ---------- or -----------------
    Session("dbConnStr") = "DSN=novoarch;UID=naowner;PWD=nadba"
    Set objConn = Server.CreateObject("ADODB.Connection")
    objConn.Open Session("dbConnStr")
    set rs = objConn.execute("{call LogUtils.sp_getloginfo(:p_errcode, :p_errdesc,
    :iCurs)}")
    SQLBindParameter is an ODBC API call that allows you to bind parameters to procedure calls, rather than providing the parameters explicitly, i.e.
    {call foo( 1, 2, 'abc' )}
    vs
    {call foo( ?, ?, ? )}
    ADO is a higher-level interface to ODBC (or OLEDB). In ADO, you accomplish the same thing with the CreateParameter & Parameter.Append functions in your code.
    Justin Cave
    ODBC Development

  • Stored Proc and dates

    Hi All,
    Fairly new at this, and a little confused with dates and date formats.
    I run the following:
    alter session set nls_date_format = 'dd/mm/yyyy'
    If I select sysdate from dual:
    02/11/2008 --> so this is correct.
    Now what I can't figure out is why I get different results if I use an sql statement VS a stored proc.
    If I run this sql update statement:
    UPDATE MAPPER.CONV_CNSTNTS
    SET CN_VALUE = TO_DATE('12/05/2007','MM/DD/YYYY')
    WHERE CN_TYPE = 'CONV'
    AND CN_REFRNCE = 'CONVDATE';
    When I select this data it shows: 12/05/2007
    This works perfect.
    Now if I take the exact same statement and put it in a stored proc i get a different result:
    create or replace procedure proc_test_date as
    begin
    UPDATE MAPPER.CONV_CNSTNTS
    SET CN_VALUE = TO_DATE('12/05/2007','MM/DD/YYYY')
    WHERE CN_TYPE = 'CONV'
    AND CN_REFRNCE = 'CONVDATE';
    COMMIT;
    end;
    When I select this data it shows: 05-DEC-07
    Why is there a difference here? Is there a difference in the NLS settings that are used when you run an sql statement vs a stored proc?
    Thanks for your help in advance.

    Thank you for the quick response.
    Glad I am on the right track ... NLS settings are painful :)
    So I ran: alter session set nls_date_format = 'Month DD, YYYY';
    Ran my proc and then the select.
    Still the date shows up as: 05-DEC-07
    I looked at the nls_parameters
    select * from v$nls_parameters
    NLS_CALENDAR     GREGORIAN
    NLS_DATE_FORMAT     Month DD, YYYY
    NLS_DATE_LANGUAGE ENGLISH
    I am using Oracle SQL Developer. I made sure these were set as well:
    Tool >> Preferences >> Database >> NLS Parameters
    Date Format --> MM/DD/YYYY
    Seems that I am missing something ...

Maybe you are looking for

  • Change font size in creative aud

    how can I change the font size in creative audigy organizer?I have gone to programs-creative -themes-033-default,but I cant find the proper themes file. I have the organizer on a large screen lcd tv and cant makeout the titles unless I get much close

  • How can I include a jsp file in other jsp from different applications?

              Hi,           I'd like know if it´s possible to include jsp or servlet from different applications.           

  • Ipod video wont go into my ipod...help please

    Im using Videora iPod Converter and it works just fine. I convertered the movie(about 1:35 mins long) to quicktime format and i exported the movie to ipod format using quicktime. Then i opened it using itunes it plays the movie in itunes just fine bu

  • Where can I find an installer for Lion for my older Mac?

    Last year I purchased Lion for my main Mac; this year I upgraded to Mountain Lion. Now I'd like to bring one of my older Macs up to the newest OS it's capable of, which is Lion. I can't find a Lion download/installer on the App store anymore. The  10

  • Time constraints and Dialog module

    1.What is the difference between the time constraints A(IT exists just once from 01 Jan 1800 to 12 Dec 9999) and B(IT exists for maximum of once from 01 Jan 1800 to 12 Dec 9999)? 2.What is the necessity of dialog module for a Infotype?