Setting a Stored Procedure Variable within a CASE Statement

I am attempting to build a Merge/Purge Key of our Members and am trying to use this syntax...
/* The First Part of the Merge/Purge Key is built on the first 4 consonants of [member].[NAME_LAST] */
SELECT
CASE
WHEN SUBSTRING([@NameLast],@Counter,1) <> 'A'
AND SUBSTRING([@NameLast],@Counter,1) <> 'E'
AND SUBSTRING([@NameLast],@Counter,1) <> 'I'
AND SUBSTRING([@NameLast],@Counter,1) <> 'O'
AND SUBSTRING([@NameLast],@Counter,1) <> 'U'
THEN CASE
WHEN @Counter = 1
THEN @MergePurgeKeyLastNamePos1 = SUBSTRING([@NameLast],@Counter,1)
I cannot seem to set my Storage Variable @MergePurgeKeyLastNamePos1 with the non-consonant value that it finds.
Do I need to over simplify this first by setting some CHAR(1) Storage Variable and then building the 4-character Merge/Purge Key of Last Name?
Thanks for your review and am hopeful for a reply?

>THEN @MergePurgeKeyLastNamePos1
=SUBSTRING([@NameLast],@Counter,1)
Assignment cannot be done in a case THEN. Only a scalar value can be returned.
You can do assignment like SELECT @variable = CASE.....
Kalman Toth Database & OLAP Architect
SQL Server 2014 Database Design
New Book / Kindle: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2014

Similar Messages

  • Invoking Oracle stored procedures from within a JDBC channel for PI 7.1

    Hi ,
    Can anybody tell me that is it possible to invoke Oracle stored Procedure from within a JDBC  sender channel for PI 7.1.
    Its working in XI3.0 and XI 7.0 for Oracle DBMS versions >= 10.2.x. But I am not sure,whether it will work for PI 7.1 also.
    Thanks & Regards,
    Saru

    HI,
    refer below link,there is no much difference in PI7.1 ,executing stored procedure is same .
    http://help.sap.com/saphelp_nwpi71/helpdata/EN/44/7b72b2fde93673e10000000a114a6b/content.htm
    Regards,
    Raj

  • Stored Procedure - variable name inside string [EXEC]

    Hi everyone
    I'm looking for a solution for this problem:
    I've created a stored procedure, in which i need to insert a record in a table.
    The point is i don't know the exact column to put my values and which values to save: it depends from the input data.
    I've created a function wich creates (concats) my query.
    The result is similar to:
    SET @myquery = 'INSERT INTO MyTable (columnABC, columnDEF) VALUES (@valueABC, @valueDEF)'
    This query is the value of a varchar.
    I want to execute this query, so I thought to use: EXEC(@myquery)
    The problem is that SQL can't find the variables @valueABC or @valueDEF if thery're inside a nvarchar.
    Is there some particular syntax in order to replace the value of variables?
    I hope it's clear!!
    Thank you in advance!!!!!
    Federica

    You need to create an entire SQL string without the variables.
    SET @myquery = 'INSERT INTO MyTable (columnABC, columnDEF) VALUES (''' + @valueABC + ''', ''' + @valueDEF + ''')'
    Please, please don't post such bad solutions!
    If you use dynamic SQL, you should use a parameterised statement:
    SET @myquery = 'INSERT INTO MyTable (columnABC, columnDEF) VALUES (@valueABC, @valueDEF)'
    EXEC sp_executesql @myquery, N'@valueABC int, @valueDEF int',
         @valueABC, @valueDEF
    However, I would prefer not to use dynamic SQL at all, but do:
    INSERT tbl(keycol, col1, col2, col3, ....)
       VALUES (@keyval,
               CASE @coltoinsert WHEN 'col1' THEN @val END,
               CASE @coltoinsert WHEN 'col2' THEN @val END,
    Although the entire idea of not knowing the columns before sounds spooky to me. A column in a table is supposed to model a unique attribute.
    Erland Sommarskog, SQL Server MVP, [email protected]
    sp_Executesql worked for me, than you very much!!!

  • Setting ViewObject Stored Procedure Where Clause Param from Struts Action

    I adapted/used Steve's example to get stored procedure to populate my ViewObject. However, I could not retrieve any rows after passing whereClause value from Struts action. The param in execureQueryForCollection returns null.
    What could be wrong. Thanks.
    Here's my code.
    ViewObjectImpl:
    package org.adb.sls.model;
    import java.math.BigDecimal;
    import java.sql.CallableStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Timestamp;
    import java.sql.Types;
    import oracle.jbo.JboException;
    import oracle.jbo.domain.Date;
    import oracle.jbo.domain.Number;
    import oracle.jbo.server.DBTransaction;
    import oracle.jbo.server.ViewObjectImpl;
    import oracle.jbo.server.ViewRowImpl;
    import oracle.jbo.server.ViewRowSetImpl;
    import oracle.jdbc.driver.OracleCallableStatement;
    import oracle.jdbc.driver.OracleTypes;
    // --- File generated by Oracle ADF Business Components Design Time.
    // --- Custom code may be added to this class.
    public class ViewApplicableLoanTypesImpl extends ViewObjectImpl
    * PLSQL block that will execute the REF_CURSOR
    private static final String SQL =
    "begin ? := sls_loan_types_pkg.get_applcbl_staff_lns_fn(?); end;";
    * PLSQL block that will count the REF_CURSOR returned rows
    private static final String COUNTSQL =
    "begin ? := sls_loan_types_pkg.get_count_applcbl_staff_lns_fn(?); end;";
    * This is the default constructor (do not remove)
    public ViewApplicableLoanTypesImpl()
    * Overridden framework method.
    * Wipe out all traces of a built-in query for this VO
    protected void create() {
    getViewDef().setQuery(null);
    getViewDef().setSelectClause(null);
    setQuery(null);
    * Overidden framework method
    protected void executeQueryForCollection(Object qc, Object[] params, int noUserParams)
    // input parameter is employee number
    String employeeNumber = null;
    if (params != null) {
    employeeNumber = (String) params[0];
    } else
    System.out.println("param is null");
    storeNewResultSet(qc,retrieveRefCursor(qc,employeeNumber));
    super.executeQueryForCollection(qc, params, noUserParams);
    protected ViewRowImpl createRowFromResultSet(Object qc, ResultSet rs)
    * We ignore the JDBC ResultSet passed by the framework (null anyway) and
    * use the resultset that we've stored in the query-collection-private
    * user data storage
    rs = getResultSet(qc);
    * Create a new row to populate
    ViewRowImpl r = createNewRowForCollection(qc);
    try {
    * Populate new row by attribute slot number for current row in Result Set
    populateAttributeForRow(r,0, nullOrNewNumber(rs.getBigDecimal(1)));
    populateAttributeForRow(r,1, nullOrNewNumber(rs.getBigDecimal(2)));
    populateAttributeForRow(r,2, rs.getString(3));
    populateAttributeForRow(r,3, nullOrNewNumber(rs.getBigDecimal(4)));
    populateAttributeForRow(r,4, rs.getString(5));
    catch (SQLException s) {
    throw new JboException(s);
    return r;
    protected boolean hasNextForCollection(Object qc)
    ResultSet rs = getResultSet(qc);
    boolean nextOne = false;
    try {
    nextOne = rs.next();
    * When were at the end of the result set, mark the query collection
    * as "FetchComplete".
    if (!nextOne) {
    setFetchCompleteForCollection(qc, true);
    * Close the result set, we're done with it
    rs.close();
    catch (SQLException s) {
    throw new JboException(s);
    return nextOne;
    protected void releaseUserDataForCollection(Object qc, Object rs)
    * Ignore the ResultSet passed in since we've created our own.
    * Fetch the ResultSet from the User-Data context instead
    ResultSet userDataRS = getResultSet(qc);
    if (userDataRS != null) {
    try {
    userDataRS.close();
    catch (SQLException s) {
    /* Ignore */
    super.releaseUserDataForCollection(qc, rs);
    public long getQueryHitCount(ViewRowSetImpl viewRowSet)
    Object[] params = viewRowSet.getParameters(true);
    String id = (String)params[0];
    CallableStatement st = null;
    try {
    st = getDBTransaction().createCallableStatement(COUNTSQL,DBTransaction.DEFAULT);
    * Register the first bind parameter as our return value of type CURSOR
    st.registerOutParameter(1,Types.NUMERIC);
    * Set the value of the 2nd bind variable to pass id as argument
    if (id == null) st.setNull(2,Types.VARCHAR);
    else st.setString(2,id);
    st.execute();
    return st.getLong(1);
    catch (SQLException s) {
    throw new JboException(s);
    finally {try {st.close();} catch (SQLException s) {}}
    * Return a JDBC ResultSet representing the REF CURSOR return
    * value from our stored package function.
    private ResultSet retrieveRefCursor(Object qc,String id) {
    CallableStatement st = null;
    try {
    st = getDBTransaction().createCallableStatement(SQL,DBTransaction.DEFAULT);
    * Register the first bind parameter as our return value of type CURSOR
    st.registerOutParameter(1,OracleTypes.CURSOR);
    * Set the value of the 2nd bind variable to pass id as argument
    if (id == null) st.setNull(2,Types.VARCHAR);
    else st.setString(2,id);
    st.execute();
    ResultSet rs = ((OracleCallableStatement)st).getCursor(1);
    * Make this result set use the fetch size from our View Object settings
    rs.setFetchSize(getFetchSize());
    return rs ;
    catch (SQLException s) {
    s.printStackTrace();
    throw new JboException(s);
    finally {try {st.close();} catch (SQLException s) {}}
    * Store a new result set in the query-collection-private user-data context
    private void storeNewResultSet(Object qc, ResultSet rs) {
    ResultSet existingRs = getResultSet(qc);
    // If this query collection is getting reused, close out any previous rowset
    if (existingRs != null) {
    try {existingRs.close();} catch (SQLException s) {}
    setUserDataForCollection(qc,rs);
    hasNextForCollection(qc); // Prime the pump with the first row.
    * Retrieve the result set wrapper from the query-collection user-data
    private ResultSet getResultSet(Object qc) {
    return (ResultSet)getUserDataForCollection(qc);
    * Return either null or a new oracle.jbo.domain.Date
    private static Date nullOrNewDate(Timestamp t) {
    return t != null ? new Date(t) : null;
    * Return either null or a new oracle.jbo.domain.Number
    private static Number nullOrNewNumber(BigDecimal b) {
    try {
    return b != null ? new Number(b) : null;
    catch (SQLException s) { }
    return null;
    Struts Action
    package org.adb.sls.view;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import oracle.jbo.ApplicationModule;
    import oracle.jbo.ViewObject;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import oracle.adf.model.binding.DCDataControl;
    import oracle.adf.model.bc4j.DCJboDataControl;
    import oracle.jbo.html.BC4JContext;
    public class IndexAction extends DefaultADFAction
    protected ActionForward performActionLogic(ActionMapping mapping,
    ActionForm form, HttpServletRequest request,
    HttpServletResponse response)
    throws Exception {
    try {    
    ApplicationModule am = getApplicationModule("SLSApplicableLoanTypesDataControl", request);
    if (am == null)
    System.out.println("am is null");
    ViewObject vo = am.findViewObject("ViewApplicableLoanTypes");
    vo.setWhereClauseParam(0,request.getSession().getAttribute("SSO_EMPLOYEE_NUMBER"));
    vo.executeQuery();
    } catch (Exception e)
    e.printStackTrace();
    return mapping.findForward("success");
    Struts Config
    <form-beans>
    <form-bean name="DataForm" type="oracle.adf.controller.struts.forms.BindingContainerActionForm"/>
    </form-beans>
    <action-mappings>
    <action path="/index" className="oracle.adf.controller.struts.actions.DataActionMapping" type="org.adb.sls.view.IndexAction" name="DataForm" unknown="false">
    <set-property property="modelReference" value="indexUIModel"/>
    <forward name="success" path="/home.do"/>
    </action>
    <action path="/home" className="oracle.adf.controller.struts.actions.DataActionMapping" type="oracle.adf.controller.struts.actions.DataForwardAction" name="DataForm" parameter="/index.uix" unknown="true">
    <set-property property="modelReference" value="indexUIModel"/>
    </action>
    </action-mappings>

    I just found the solution. I've overridden setWhereClause method.
    public void setWhereClauseParams(Object[] values)
    ViewObjectImpl vo = (ViewObjectImpl) super.getViewObject();
    vo.setWhereClauseParam(0,values[0]);
    }

  • Calling stored procedure from within container TX

    Hi
    I am calling a stored procedure that resides locally (Oracle) from within a session
    bean after updating a number of ejb's. The stored procedure works fine if it performs
    a simple delete. However, the stored procedure is in turn calling another stored
    procedure that may reside in a different db. In such a case the update to the
    ejb's in not reflected at all. Is this possible to do this within one tx? BTW
    there is a reason I'm not calling the remote SP directly.
    Thanks

    Hi,
    I am not sure if I fully understand your question, but here is a list of points which you
    should check:
    - transaction boundaries
    - transaction isolation level
    - XA datasources and drivers
    - are the changes from the SP commited properly to the database ?
    - also note that WLS5.1 (if you are using it ?) supports 2 phase commit only with a
    single datasource
    Regards,
    Christian Buchegger
    Developer Relations Engineer
    BEA Support
    Michael schrieb:
    Hi
    I am calling a stored procedure that resides locally (Oracle) from within a session
    bean after updating a number of ejb's. The stored procedure works fine if it performs
    a simple delete. However, the stored procedure is in turn calling another stored
    procedure that may reside in a different db. In such a case the update to the
    ejb's in not reflected at all. Is this possible to do this within one tx? BTW
    there is a reason I'm not calling the remote SP directly.
    Thanks

  • Performance to fetch result set from stored procedure.

    I read some of related threads, but couldn't find any good suggestions about the performance issue to fetch the result set from a stored procedure.
    Here is my case:
    I have a stored procedure which will return 2,030,000 rows. When I run the select part only in the dbartisan, it takes about 3 minutes, so I know it's not query problem. But when I call the stored procedure in DBArtisan in following way:
    declare cr SYS_REFCURSOR;
    firstname char(20);
    lastname char(20);
    street char(40);
    city char(20);
    STATE varchar2(2);
    begin DISPLAY_ADDRESS(cr);
    DBMS_OUTPUT.ENABLE(null);
    LOOP
    FETCH cr INTO firstname,lastname,street, city, state;
    EXIT WHEN cr%NOTFOUND;
    DBMS_OUTPUT.PUT_LINE( firstname||','|| lastname||','|| street||',' ||city||',' ||STATE);
    END LOOP;
    CLOSE cr;
    end;
    It will take about 100 minutes. When I used DBI fetchrow_array in perl code, it took about same amount of time. However, same stored procedure in sybase without using cursor, and same perl code, it only takes 12 minutes to display all results. We assume oracle has better performance. So what could be the problem here?
    The perl code:
    my $dbh = DBI->connect($databaseserver, $dbuser, $dbpassword,
    { 'AutoCommit' => 0,'RaiseError' => 1, 'PrintError' => 0 })
    or die "couldn't connect to database: " . DBI->errstr;
    open OUTPUTFILE, ">$temp_output_path";
    my $rc;
    my $sql="BEGIN DISPLAY_ADDRESS(:rc); END;";
    my $sth = $dbh->prepare($sql) or die "Couldn't prepare statement: " . $dbh->errstr;
    $sth->bind_param_inout(':rc', \$rc, 0, { ora_type=> ORA_RSET });
    $sth->execute() or die "Couldn't execute statement: " . $sth->errstr;
    while($address_info=$rc->fetchrow_arrayref()){
    my ($firstname, $lastname, $street, $city, $STATE) = @$address_info;
    print OUTPUTFILE $firstname."|".$lastname."|".$street."|".$city."|".$STATE;
    $dbh->commit();
    $dbh->disconnect();
    close OUTPUTFILE;
    Thanks!
    rulin

    Thanks for you reply!
    1) The stored procedure has head
    CREATE OR REPLACE PROCEDURE X_OWNER.DISPLAY_ADDRESS
    cv_1 IN OUT SYS_REFCURSOR
    AS
    err_msg VARCHAR2(100);
    BEGIN
    --Adaptive Server has expanded all '*' elements in the following statement
    OPEN cv_1 FOR
    Select ...
    commit;
    EXCEPTION
    WHEN OTHERS THEN
    err_msg := SQLERRM;
    dbms_output.put_line (err_msg);
    ROLLBACK;
    END;
    If I only run select .. in DBArtisan, it display all 2030,000 rows in 3:44 minutes
    2) But when call stored procedure, it will take 80-100 minutes .
    3) The stored procedure is translated from sybase using migration tools, it's very simple, in sybase it just
    CREATE PROCEDURE X_OWNER.DISPLAY_ADDRESS
    AS
    BEGIN
    select ..
    The select part is exact same.
    4) The perl code is almost exact same, except the query sql:
    sybase verson: my $sql ="exec DISPLAY_ADDRESS";
    and no need bind the cursor parameter.
    This is batch job, we create a file with all information, and ftp to clients everynight.
    Thanks!
    Rulin

  • Stored Procedure/Variable issue

    Hopefully this is the last issue to work through... but we need to access images stored on another server. We have a stored procedure called 'get_doc' that accesses the image file, and we've successfully tested it with a hardcoded value. A button calls a process that executes the following PL/SQL:
    get_doc (
    p=> 77456);
    However, when I use the same process with a variable on the page (which has the same numeric value of 77456), the procedure says the value of p is Null.
    get_doc (
    p=> :P7_STARTERNUM);
    Any suggestions or advice?
    (Using ApEx 4.0 in IE8)

    CPate  wrote:
    Yes, the connection is correct. And I swapped in the hardcode number, the process does what it is supposed to and returns the image. Swap back in the variable (with to_number as well, just to be sure) and it returns null.
    I tried debugging it and didn't see where P7_STARTERNUM was changed. It just says:
    ..Process "STARTERGET": PLSQL (AFTER_SUBMIT) get_doc (p=&gt; to_number(:P7_STARTERNUM));The trace should look something like:
    0.00275     0.00220     A C C E P T: Request="SAVE"
    0.00484     0.00801     Metadata: Fetch application definition and shortcuts
    0.01291     0.00110     alter session set nls_language="ENGLISH"
    0.01399     0.00069     alter session set nls_territory="UNITED KINGDOM"
    0.01476     0.00084     NLS: CSV charset=WE8MSWIN1252
    0.06085     0.00087     Session State: Save form items and p_arg_values
    0.06173     0.00146     ...Session State: Save "P7_CUSTOMER_ID" - saving same value: "7"
    0.06319     0.00264     ...Session State: Save Item "P7_CUST_FIRST_NAME" newValue="Eugene" "escape_on_input="N"     
    0.33200     0.00090     Processing point: After Submit
    0.33285     0.11813     ...Process "Process Row of DEMO_CUSTOMERS": DML_PROCESS_ROW (AFTER_SUBMIT) #OWNER#:DEMO_CUSTOMERS:P7_CUSTOMER_ID:CUSTOMER_ID|IUD
    {code}
    There should be a session state change like those shown recorded for your <tt>P7_STARTERNUM</tt> item.
    What's the *Display As* type of the <tt>P7_STARTERNUM</tt> item?
    the procedure says the value of p is Null.
    How do you know this?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Multiple result sets from stored procedure into CachedRowSet

    How can you obtain multiple sets of data from a stored procedure that returns multiple result sets, when you'd like to use CachedRowSet rather than ResultSet?
    My database's stored procedures return multiple result sets, but I'm not sure how to manipulate that using CallableStatements and CachedRowSets... I read the RowSet tutorial from java.sun.com but that didn't cover the case of multiple result sets and CallablStatements.
    How might I do this? Thanks a lot.

    SELECT columns..
    FROM table
    FOR XML PATH('NodeName'),('Rootname')
    Thank you for replying.
    I dont have to generate XML from a query. I have to generate from a SP and that too without modifying it.
    Thanks,
    Tauhid
    thats ok you can do like this
    1. Create a table with structure same as SP resultset
    2. Populate table with SP result as per below
    INSERT table
    EXEC SPName param1value,...
    3. Add a query like below
    SELECT columns..
    FROM tablename
    FOR XML PATH('NodeName'),('RootName')
    see
    http://visakhm.blogspot.com/2014/05/t-sql-tips-fun-with-for-xml-path.html
    4. Use sp_send_dbmail to sent it through mail
    http://msdn.microsoft.com/en-IN/library/ms190307.aspx
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Calling a stored procedure from within a ViewObject

    Is it possible to make stored procedure call from within a BC4J ViewObject? Basically something like this:
    select * from table(f1(3)); where f1 is a table function. Using Oracle's pipelined table functions?
    If not, is it possible to call a stored procedure from Java and have the returned results be put back into a BC4J RowSet.
    In addition, is there a way to create a JDBC Resultset from a BC4J RowSet?
    We need to be able to dynamically create our SQL statements (the entire SQL, not just the where clause) but are required to have these sql statements generated/executed from within a pl/sql stored procedure in the database.

    Is it possible to make stored procedure call from within a BC4J ViewObject? Basically something like this:
    select * from table(f1(3)); where f1 is a table function. Using Oracle's pipelined table functions?
    Yes. Using our expert-mode query feature this is possible.
    is it possible to call a stored procedure from Java and have the returned results be put back into a BC4J RowSet.
    Yes. See this article about basing a view object on a REF CURSOR:
    http://radio.weblogs.com/0118231/2003/03/03.html
    In addition, is there a way to create a JDBC Resultset from a BC4J RowSet?
    No. Not directly. What's the business requirement here so I can understand better?
    We need to be able to dynamically create our SQL statements (the entire SQL, not just the where clause) but are required to have these sql statements generated/executed from within a pl/sql stored procedure in the database.
    REF CURSOR would work fine, or if it's just the statement that needs to be generated dynamically, you could fetch the text of the SQL statement from the stored procedure, then use createViewObjectFromQueryStmt(). Although this has runtime overhead involved with describing the query.
    The REF CURSOR based approach is probably best for this.

  • Hashset Object Setting in Stored procedure

    I have a store Procedure:
    CREATE PROCEDURE TESTING_SET(TEST_SET SET(CHAR(100) NOT NULL))
    RETURNING CHAR(100);
    DEFINE element CHAR(100);
    FOREACH SELECT * INTO element FROM TABLE(TEST_SET)
    RETURN element WITH RESUME;
    END FOREACH;
    END PROCEDURE;
    I am trying to call a stored procedure using CallableStetement. The stored procedure accepts a SET object. So I am setting the Hasset as CallableStatement.setObject(HashSet);
    But when the CallableStatement.execte() is called I am getting the following error:
    java.sql.SQLException: Routine (testing_set) can not be resolved.
    at com.informix.jdbc.IfxSqli.a(IfxSqli.java:3631)
    at com.informix.jdbc.IfxSqli.E(IfxSqli.java:3963)
    at com.informix.jdbc.IfxSqli.dispatchMsg(IfxSqli.java:2693)
    at com.informix.jdbc.IfxSqli.receiveMessage(IfxSqli.java:2609)
    at com.informix.jdbc.IfxSqli.a(IfxSqli.java:1828)
    at com.informix.jdbc.IfxSqli.executeExecute(IfxSqli.java:2521)
    at com.informix.jdbc.IfxSqli.executeExecute(IfxSqli.java:2461)
    at com.informix.jdbc.IfxResultSet.b(IfxResultSet.java:393)
    at com.informix.jdbc.IfxStatement.a(IfxStatement.java:1326)
    at com.informix.jdbc.IfxPreparedStatement.d(IfxPreparedStatement.java:449)
    at com.informix.jdbc.IfxCallableStatement.execute(IfxCallableStatement.java:331)
    at com.west.wic.test.HashSetTest.main(HashSetTest.java:40)
    Caused by: java.sql.SQLException
    at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:413)
    at com.informix.jdbc.IfxSqli.E(IfxSqli.java:3968)
    ... 10 more
    error message:Routine (testing_set) can not be resolved.
    error code:-674
    Please help me in this regard.

    >
    I wasn't directly replying to you
    >
    Well maybe that wasn't your intention but that is what this line in the reply means:
    >
    Posted: May 3, 2013 12:19 PM in response to: rp0428
    >
    That means you are responding to 'rp0428'; that's me. So when you say this
    >
    But first make sure that the database user you're using
    >
    And because your comments are 'in response to: rp0428' the word "you're" is generally going to be interpreted to mean 'rp0428' unless you indicate otherwise.
    If you had responded to OP that word "you're" would mean you are telling OP to
    >
    first make sure that the database user you're using
    >
    It isn't a question of 'right'; it is a question of how to address your remarks to the proper person so that that person KNOWS the remarks are meant for them.
    Here's an easy way for you to remember who to reply to: it is the same person you would LOOK at if you were in the same room with them.
    You would be looking at me while you were listening to my comments. Then you would turn and look at OP when you made yours. In the forum you accomplish that by using the 'reply' link on one of OP's comments.
    If, for some reason, you did want to make comments to both of us in your one reply then pick one to reply to, even me, and then preface your comment to OP like this:
    >
    -- comment here for rp0428 - but you didn't make any
    OP: first make sure that the database user you're using . . .
    >
    See how that 'OP:' prefix makes it clear that, even though your comments are 'in response to: rp0428' that particular comment is meant for OP?
    It might be aarkward at first but once you try it a few times you'll get the hang of it. ;)

  • Getting result set from stored procedures in database controls in weblogic

    I am calling a stored procedure from database control which actually returns a result set
    when i call the stored procedure like
    * @jc:sql statement="call PROC4()"
    ResultSet sampleProc() throws SQLException;
    it gives me exception saying
    "weblogic.jws.control.ControlException: Method sampleProc is DML but does not return void or int"
    I would appreciate any help
    Thanks,
    Uma

    Thanks for you reply!
    1) The stored procedure has head
    CREATE OR REPLACE PROCEDURE X_OWNER.DISPLAY_ADDRESS
    cv_1 IN OUT SYS_REFCURSOR
    AS
    err_msg VARCHAR2(100);
    BEGIN
    --Adaptive Server has expanded all '*' elements in the following statement
    OPEN cv_1 FOR
    Select ...
    commit;
    EXCEPTION
    WHEN OTHERS THEN
    err_msg := SQLERRM;
    dbms_output.put_line (err_msg);
    ROLLBACK;
    END;
    If I only run select .. in DBArtisan, it display all 2030,000 rows in 3:44 minutes
    2) But when call stored procedure, it will take 80-100 minutes .
    3) The stored procedure is translated from sybase using migration tools, it's very simple, in sybase it just
    CREATE PROCEDURE X_OWNER.DISPLAY_ADDRESS
    AS
    BEGIN
    select ..
    The select part is exact same.
    4) The perl code is almost exact same, except the query sql:
    sybase verson: my $sql ="exec DISPLAY_ADDRESS";
    and no need bind the cursor parameter.
    This is batch job, we create a file with all information, and ftp to clients everynight.
    Thanks!
    Rulin

  • Result Sets and Stored Procedure

    In advance one question in general - since I never know: What actually is a result set???
    Is it a cursor with a direct connection to the server-side database-data ? Or is it just a copy of the results once "loaded" by the query and delivered by the Server to the client ???
    Second: I have a Stored Procedure on a MS SQL Server 2000
    I try to call the stored procedure via jdbc. The last query in the Stored Proc is a query relying on local temporary tables. If I execute the stored procedure by my java-class, i get a
    java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]No ResultSet set was produced.
    The usual "Select, Update and Insert-stuff" works fine with JDBC.
    Stored Procedures WITHOUT resultset work fine too.
    But this one just refuses to give me the results.
    Executing the same stored procedure in 'MS SQL-QUERYANALYZER' gives me my expected results.
    Any ideas?
    Sven

    In advance one question in general - since I never
    know: What actually is a result set???
    Is it a cursor with a direct connection to the
    server-side database-data ? Or is it just a copy of
    the results once "loaded" by the query and delivered
    by the Server to the client ???The first one, more or less. It relies on the connection to retrieve the results, .. if the connection is lost, so is the data in the ResultSet.
    Second: I have a Stored Procedure on a *MS SQL Server
    2000*
    I try to call the stored procedure via jdbc. The last
    query in the Stored Proc is a query relying on local
    temporary tables. If I execute the stored procedure by
    my java-class, i get a
    java.sql.SQLException: [Microsoft][SQLServer JDBC
    Driver]No ResultSet set was produced.Have you tried a basic stored procedure that should return a ResultSet?.. maybe one that doesn't rely on the temporary tables? You may want to also check with the support for the driver you're using since that's really where the ability to use stored procedures resides.

  • Error Calling Oracle Stored Procedure From Within Report

    Hi,
    I have a report that calls an oracle stored procedure which returns a ref cursor. The report is working ok in our development environment when called from our development website through .NET.
    When the report is moved and accessed from our UAT website we get the following error :-
    Failed to open a rowset. Details: ADO Error Code: 0x Source: Microsoft OLE DB Provider for Oracle Description: One or more errors occurred during processing of command. Failed to open a rowset. Details: ADO Error Code: 0x Source: Microsoft OLE DB Provider for Oracle Description: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'RHS_GET_CAND_SECTION_REFS' ORA-06550: line 1, column 7: PL/SQL: Statement ignored Native Error: Failed to open a rowset. Error in File C:\WINDOWS\TEMP\temp_d663a952-bef6-4bf7-bf1a-5e288afdb612 {9B6DFB38-A436-4940-9D80-B4C23DFFFF19}.rpt: Failed to open a rowset.
    If we open the report manually we are prompted to enter database connection info. If we enter the UAT connection details the report runs ok. If we save the report and try to open it from UAT website through .NET it now opens ok.
    If we then move that same report back to the development environment and open from our development website it fails with the same error above.
    Both connections are using Microsoft OLE DB drivers and the Oracle databases are the same version (10.2.0.1.0).
    Is the connection information being stored in actual report and somehow being used when the report is opened through .NET?
    Any help appreciated
    Regards
    Paul

    Hi,
    Please let me know if the issue occurs with the crystal reports designer, if you are facing issues with the .NET application then a need to create a post [here|SAP Crystal Reports, version for Visual Studio;.
    Regards,
    Hitesh

  • Simple stored procedure - select with an if statement, returning a cursor

    Hi,
    I'm trying to create a very simple stored procedure, but having never worked with them before I'm not quite sure what I'm doing wrong.
    Here's my code:
    create or replace
    procedure contact_return(
        v_contact_id IN varchar2,
        p_cursor OUT SYS_REFCURSOR)
    AS
    begin
      set sql_statement varchar2(4000) := '
        SELECT URN,
          FIRSTNAME,
          LASTNAME,
          TITLE,
          CREATED_DT,
          AREA_URN,
          MOBILE,
          WORK,
          EMAIL,
          ORG_NAME,
          ADDRESS,
          POSTCODE,
          IN_USE
        FROM CONTACT';
      if v_contact_id is not null then
        sql_statement := sql_statement || ' where urn = ' || v_contact_id;
      end if;
      open p_cursor for sql_statement;
    end;
    It's actually returning 2 errors:
    Error(7,3): PL/SQL: SQL Statement ignored
    Error(7,7): PL/SQL: ORA-00922: missing or invalid option
    Which seem to be a problem with my set sql_statement line, but it looks correct to me?
    Thanks

    rajendra wrote:
    Dear User,
    It is not allowed to declare a variable inside the PL/SQL block means after begin ( in your case line no 7 ).
    Lot of errors in your code.
    Tell me your exact requirement and what you want to do , after that I will be able to solve your problem.
    Thanks,
    Rajendra
    Well, you can declare after the begin, though it'll be as part of an embedded code block e.g.
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace procedure contact_return(empno IN  number
      2                                            ,c     OUT SYS_REFCURSOR
      3                                            ) AS
      4  begin
      5    declare
      6      sql_statement varchar2(4000) := '
      7        select *
      8        from emp
      9        where empno = nvl(:1,empno)';
    10    begin
    11      open c for sql_statement using contact_return.empno;
    12    end;
    13* end;
    SQL> /
    Procedure created.
    SQL> var x refcursor
    SQL> exec contact_return(7788,:x);
    PL/SQL procedure successfully completed.
    SQL> print x;
         EMPNO ENAME      JOB              MGR HIREDATE                    SAL       COMM     DEPTNO
          7788 SCOTT      ANALYST         7566 19-APR-1987 00:00:00       3000                    20
    so, it is allowed, as long as it's coded correctly.

  • How to call stored procedure in SYBASE using callable statement

    Hi all,
    Im using jdbc code to execute a stored procedure in sybase but while running the code i get an error saying
    java.sql.SQLException: JZ0R2: No result set for this query.
    at com.sybase.jdbc2.jdbc.ErrorMessage.raiseError(ErrorMessage.java:506)
    at com.sybase.jdbc2.jdbc.SybStatement.queryLoop(SybStatement.java:1552)
    at com.sybase.jdbc2.jdbc.SybStatement.executeQuery(SybStatement.java:1522)
    at com.sybase.jdbc2.jdbc.SybCallableStatement.executeQuery(SybCallableStatement.java:76)
    but when i execute the same procedure in sybase it returns some result but i know its not in resultset format .I want to know is anyone experienced same problem in their side.
    My question is how to obtain the result which is not in the format result set obtained by executing the stored procedure.
    Thanks n advance
    work machine

    Check this post out:
    http://forum.java.sun.com/thread.jspa?threadID=638768&messageID=3785982
    But I think you should be getting results right? What do you mean you want it in a format other than resultset?

Maybe you are looking for

  • Payment terms along with card

    Hi I want to use both credit cards and payment terms working in an order. For eg if the order value is 100 i want to received 10 from card and balance by instalement how can i acheive this.

  • Binary file is greyed out in Write Measuremen​t File express VI.

    I am running labview 8.2 on Fedora 7 Core.  I have also installed it on an earlier version of fedora that was in line with the supported red hat distribution.  The problem is that when I try to use the Write Measurement File express VI, the binary fi

  • Apache in front of OC4J?  AJP13?

    Hello, I need to place OC4J behind Apache. I have a working Apache setup that talks to JBoss/Jetty via AJP13 on port 8009. How can I configure OC4J to listed to some port and listen for AJP13 requests? Does OC4J come with its own protocol and Apache

  • Why 'wrong number of parameters' error in this call to a stored procedure?

    A stored procedure exists that inserts a new record and returns the newly generated record ID. This stored procedure is called from a WinForms application but at the ExecuteNonQuery time an exception is thrown indicating that the wrong number of para

  • WRT54g with VPN Firewall

    Would like to configure the VPN firewall with my existing system.  I have Verizon DSL which involves the DSL modem and the Firewall.  I have the IP addresses of each.  How would I determine an appropriate IP address for the firewall.  Should the devi