UCM & store procedeure (PL/SQL)

Does anyone know how to get the output parameters of a PL/SQL statement?
DECLARE
code VARCHAR(20);
begin
code := get_code(?,?);
end;
I have tried with this code inside my java class but i failed.
CallableResults crs = this.m_workspace.executeCallable("Queryname",this.m_binder);
DataResultSet drs_call = new DataResultSet();
drs_call.copy(crs.getResultSet());
this.m_binder.addResultSet("XX", drs_call);
this.m_binder.putLocal("XX",crs.getString("CODE"));
Edited by: m.mauri on May 4, 2011 6:25 AM

For made up procedure below:
create or replace procedure my_procedure
( param1 in number, param2 in out varchar2, param3 out number )
as
begin
  param2 := param2 || param1;
  param3 := param1 + 2;
end my_procedure;Define query as below:
<tr>
     <td>(ORACLE)myProcedureCall</td>
     <td>{call my_procedure( ?, ?, ? )}</td>
     <td>param1 int
         param2 inout:varchar
            param3 out:int</td>
</tr>Retrieve results as below:
final DataBinder binder = new DataBinder();
binder.putLocal( "param1", "15" );
binder.putLocal( "param2", "test" );
CallableResults result = p_workspace.executeCallable( "myProcedureCall", binder );
String inOutParam = result.getString( "param2" );
int outParam = result.getInteger( "param3" );Hope this helps,
Fabian
Edited by: fscherpe on May 9, 2011 9:10 AM
See also: http://fscherpe.blogspot.com/2011/05/calling-stored-procedures-from-within.html

Similar Messages

  • Problem to store a oracle sql result into a variable

    Hello everyone,
    I'm working on a little project that use c#, Oracle ODT and asp.net, so here is the thing, I need to save the result of a sequence (SECNUM.NEXTVAL ) into a variable, then call that value from many inserts and querys and for last make the commit. My problem is that I don't know how to convert the string result to a number and the call it from the statements. Always brings two errors, one is invalid number because Im sending a string and the another is that if I comment the line cmd.ExecuteNonQuery(); the script runs but no commit happens.
    This is my code, is attached to a button:
    C# Syntax (Toggle Plain Text)
    string oradb = "Data Source=BBDD;User Id=DEMO;Password=DEMO;";
    string cmd1 = "SELECT SECNUM.NEXTVAL FROM DUAL";
    OracleConnection conn = new OracleConnection(oradb);
    conn.Open();
    OracleParameter parm = new OracleParameter();
    parm.OracleDbType = OracleDbType.Decimal;
    OracleCommand cmd = new OracleCommand();
    cmd.Connection = conn;
    cmd.Parameters.Add(parm);
    cmd.CommandText = "INSERT INTO DEMOINCI (CODINCI, CODCLI) VALUES (('" + cmd1 +"'), 'TEST')";
    cmd.CommandText = "INSERT INTO DEMOINCILIN (CODINCI,CODLIN) VALUES (('" + cmd1 +"'),1)";
    cmd.CommandType = CommandType.Text;
    cmd.ExecuteNonQuery();
    So my problem is that the column CODINCI is a column number of (9) and not a VARCHAR and can not be changed because is already have data, so when I use the code of the example, Oracle return an error saying Invalid number (of course).
    With the help of a friend I tried to put with the cast like this cmd.CommandText = "INSERT INTO DEMOINCI (CODINCI, CODCLI) VALUES (" + "CAST(" + cmd1 + "AS NUMBER), 'TEST')"; and it works but only if I comment the line cmd.ExecuteNonQuery();, so the commit never happend and of course there is no insert in the database.
    ¿It is so difficult to store a result of an SQL into a variable and then call it back on a statement?, on Oracle Forms you create a cursor like cursor=CVAL SELECT SECNUM.NEXTVAL VAL FROM DUAL and that it you can then use the VAL result into all other queries of the same form an retrieving with the :VAL option.
    Thanks for all the help.

    I just had to do something similar for my C# class, using SQL Server. The primary key for a "Customers" table was an auto-incrementing integer. After inserting a new customer I had to retrieve and display the primary key:
    string selectStatement = "SELECT IDENT_CURRENT('Customers') from Customers";
    SqlCommand selectCommand = new SqlCommand(selectStatement, connection);
    int customerID = Convert.ToInt32(selectCommand,ExecuteScalar());
    The ExecuteScalar() method of selectCommand returned the first column of the first row of the dataset, which in this case was the key of the new Customers record, as an object. Convert.ToInt32() converted the key to an integer.
    Once you store SECNUM.NEXTVAL as an integer, you can use it to create a Parameter for the Command object.
    HTH.

  • How to write a store procedure under SQL Server 2008

    Hi Folks,
    Kindly help me step by step how to create a simple store procedure with help of sql server 2008 r2 for Crystal report.
    I know how to work by using Universe but not SQL Server. Kindly help me how to hard code by using sql.
    Thanks in adv.
    Reddy

    For the actual syntax for programming the stored proc, you'll need to work with someone (or a website) who knows T-SQL.
    The cursor that gets returned from the stored proc must be an "in out" parameter for the stored proc.  For SQL Server I usually define a record type that includes the fields that will be returned and then return a set of records of that type.  Again, check with someone who is familiar with T-SQL for more information about how to do this.
    -Dell

  • STORE command in SQL*Plus

    Is there a way to avoid the message
    "Wrote file xxx" ?

    Iam amidst spooling a longer an difficult report.
    I have TERM OFF.
    I need to call some kind of "standard procedure" that sets some of the SETS (that's a nice one).
    So to STORE before and to restore (START the store-file) afterwards would be a nice way to overcome the reset in the Standard procedure.
    But now, I have this dumb message (Wrote file xxx, sorry that a plus-, no sql-message, there is no code!) in the spoolfile.
    And I have found no way to suppress it. Probably there is none.
    So I asked the community.

  • Call Store Procedure in SQL Server

    How can I call an Oracle Store Procedure in a SQL Server procedure?

    Make sure you're calling the stored procedure with the same parameters at the same database. If that's not the case then send the procedure body and how you are calling it from code and DB .
    "If there's nothing wrong with me, maybe there's something wrong with the universe!"

  • Map progress with stars per lesson. How to store/request stats sql

    The massive SQL request for the map is for loading the progress, not for the image. I store for every lesson result (1-3 stars). Lets say the player completed all (10) lessons of a map. To show the map with its stars, I would have to request point the highest score for each map. Not sure now if this can be done in only one SQL call. Have to check this.
    Another way of doing it is storing all needed data (number of stars for each map point) in a JSON encoded string to the database. So it’s just one request. But useless for statistics, so it’s still necessary to write each lesson to “results”.
    Shouldn't I just keep those stats locally so I don't have to request them from the server every time?

    Well, been reading and mysql can handle billions of rows. So I think I read that there is some slow down in the chain
    AIR - browser(php) - mysql - broswer - AIR
    I know mysql processes damn fast so somewhere in that chain things are getting slowed down. I read somewhere that stored procedures in the mysql db help as they are already compiled and you can also execute various commands with one sql call. Also, helps against sql injection.
    Is that right??? and where might the "slow down" come from?

  • UCM 11g and Weblogic SQL Authenticator

    A bit lengthy question about UCM 11g using WLS Security providers for user authentication.
    There's a lot of stuff on the web about integrating UCM 11g with WLS AD/LDAP authenticators. However there's literally nothing about integrating it with SQL-based authenticators. Does it mean that using WLS's built-in providers other than AD/LDAP is not supported ?
    I tried configuring my Custom DBMS Authenticator - it works fine. I can see my users/groups and membership info read from the DB in WLS Admin Console. The users can even log in to the Content Server but their WLS groups are never mapped to UCM roles/accounts. I tried reordering the WLS authenticators so that the DBMS authenticator is at the top but this does not help. Does this mean that group -> role/account mapping works only with LDAP ?
    thanks in advance

    Hi Sirnath,
    Thanks for the prompt reply.
    I did another exercise and defined the contributor group in both the DefaultAuthenticator and the SQL Authenticator and created two users 'default' (int the DefaultAuthenticator) and 'sql' (in the SQL authenticator). Both users are members of the 'contributor' group (in the respective Authenticator). If I log in as either of the users they all have the proper principals/credentials set in the javax.security.auth.Subject instance (the 'contributor' is a principal and a credential in both cases). However UCM maps it to a role only for the 'default' user.
    Is it possible that the JPS provider somehow bypasses the javax.security.auth.Subject abstraction? Do you know of any related docs available online ?

  • Passing a table-field value in Crystal to a Store Procedure in SQL Server

    I have been checking all over the interenet via searches and although some seem to come close to this, its still not what I want.
    Essentially I need to pass value from Table-Field record (for each record read/selected) via a paramete to a Stored Procedure(SP) in SQL Server 2205/2008.  I do NOT want to be prompted for a value for this parameter each time the report is run, simple pass the value in which will be used along with other select criteria to bring back one value for the report to use in a calcuation per record.
    The value of the parameter is a date, but I understand it would be better to pass it in as a varchar(8) - 'YYYYMMDD' - and then reconvert it inside the SP, as follows:
    In Crystal Reports 2008 SP3, I have a formula defined as,
    trans_date = ToText ({F1ARS_STMT_WS_TRAN.TRANS_DATEI}, 'YYYYMMDD')
    and essential just want to pass this to the SP below ... i.e. trans_date  ---> @strTransDate
    I then link the key fields [EXCH_RATE_TABLE_NAME] and [TRANS_CCY_CODE] to other tables in the Database Expert, and put [EXCH_RATE_AMT] on the report and use it to calculate what I want.
    This works fine when the prompt comes up and I put in a proper date, but I don't what it to prompt, but simple pass the F1ARS_STMT_WS_TRAN.TRANS_DATEI in via the fornula/parameter and let teh SQL do the rest for each record selected..
    CREATE PROCEDURE [dbo].sp_GET_EXCH_RATE_AMT (@strTransDate varchar(8))     --use format 'YYYYMMDD' to represent the date as a string.
         -- Add the parameters for the stored procedure here
         -- @TransDate datetime = now
    AS
           declare @TransDate datetime
         set @TransDate = CONVERT(DATETIME, @strTransDate, 112)
    BEGIN
         -- SET NOCOUNT ON added to prevent extra result sets from
         -- interfering with SELECT statements.
         SET NOCOUNT ON;
        -- Insert statements for procedure here
    SELECT [EXCH_RATE_TABLE_NAME], [TRANS_CCY_CODE], [EXCH_RATE_AMT]
    FROM [F1CCY_EXCH_RATE]
    WHERE [MAJOR_CCY_CODE] = 'BBD'
    AND   [START_DATEI] =
         SELECT MAX([START_DATEI])
         FROM [F1CCY_EXCH_RATE]
         WHERE [MAJOR_CCY_CODE] = 'BBD'
         AND   [START_DATEI] <= @TransDate
    END
    GO
    GRANT EXECUTE ON sp_GET_EXCH_RATE_AMT TO PUBLIC
    GO
    Thanks for any help.  Can't tell the headache this has caused my both literally and figuratively.

    Hello,
    I moved your post to the Report Design forum. Lots of SQL help in here...
    I believe the problem is due to you using a Parameterized Stored Procedure. The first thing CR has to do is connect to your DB source which requires the date parameter before it can run the query to add the date filter, it's the SP that is prompting for the parameter. Therefore the report has not run so it can't get the field value from the report until you fill in the info for the SP. Catch 22 problem.... Which came first, the Chicken or the Parameter....
    The report will work as you have noted but I don't know of anyway to refresh unless parameter is filled in again....
    Jason has a lot of great solutions when it comes to these dilemmas, Possibly using a Command Object may help but I believe you will still run into the same issue....
    Only way I can think of is to not use a parameter in the SP and let CR do the filtering client side. Of course this means all data is coming back to the client PC as you are likely trying to find a work around for.
    Thank you
    Don

  • Run package store procedure in sql developer

    Night staff, I am using Oracle 11g, only that it gives the following error below, which can be wrong and how to rotate within the sql developer?
    Warning(3,18): PLW-07203: o parâmetro 'CODCEP_EMP' pode se beneficiar do uso da hint do compilador NOCOPY
    ror starting at line 1 in command:
    exec buscadb.tabemp('09811370');
    Error report:
    ORA-06550: linha 1, coluna 7:
    PLS-00306: número incorreto de tipos de argumentos na chamada para 'TABEMP'
    ORA-06550: linha 1, coluna 7:
    PL/SQL: Statement ignored
    06550. 00000 - "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    *Action:
    create or replace PACKAGE BUSCADB AS
    TYPE t_cursor IS REF CURSOR;
    PROCEDURE TABEMP(CODCEP_EMP IN OUT empresas.cep_emp%TYPE,io_cursor OUT t_cursor);
    END BUSCADB;
    create or replace PACKAGE BODY BUSCADB AS
    PROCEDURE TABEMP(CODCEP_EMP IN OUT empresas.cep_emp%TYPE,io_cursor OUT t_cursor) AS
    v_cursor t_cursor;
    begin
    open v_cursor for
    select cod_emp,nom_emp,end_emp,cep_emp
    from empresas
    where cep_emp = codcep_emp;
    io_cursor := v_cursor;
    END TABEMP;
    END BUSCADB;

    These questions should be posted in the SQL And PL/SQL forum.
    But I can give you this: READ the error. The procedure takes 2 parameters, you only give 1.
    Regards,
    K.

  • Hi, plz help me. i wanna store photos to sql database. so how to insert file field into insert record in dreamweaver cs3?

    I dont know how to insert file field into insert record in DW. i also want to know, insert dynamic table with image field. Plz help me anyone. Ty..

    ohh kk thank you bro. But How to store photos to server file. I wanna upload and display the photos in webpage. Can you send me the php code for this?

  • How to do  store with dynamic sql to return a cursor

    i need to do a store that returns a cursor, but the expression of the cursor are genereted dynamicly. how can i do that?
    something like this:
    sql_stmt := 'SELECT * FROM ' || INTABLE || ' WHERE '|| inWhereClause;
    EXECUTE IMMEDIATE sql_stmt into C1;
    where c1 is a ref cursor( OUT variable of procedure)
    it is possible or not?
    Pedro Cardoso

    The syntax is something like
    sql_stmt := 'Select * from '|| InTable||' WHERE '|| InWhereClause ;
    OPEN C1 for Sql_Stmt ;

  • Make Interactive report from Oracle Store Procedure returning SQL

    I have the following type of Report Region:
    Report Region Type:
    SQL Query (PL/SQL function body returning SQL query)
    Region Source:
    DECLARE
    q varchar2(4000);
    BEGIN
    GetMySQLString(:P22715_SID, q);
    return q;
    END;
    function GetMySQLString() return varchar2 is
    begin
    return 'select * from myTable';
    end GetMySQLString;
    For some reason though I can't figure out how to get it to work with an Interactive Report.... Basically I want the report to use the SQL returned by the Oracle Stored Function....
    Any thoughts?

    Should have searched better!
    Guess this should help: Calling Procedure or Function from Interative Report
    Edited by: tward on Sep 3, 2010 8:55 AM

  • How to get the incoming filename and store it to sql table using biztalk server 2013

    HI,
    1)I need to get the incoming EDI filename which is received and save the filename in to the database.
    2)How can i get the EDI Duplicate filename if i set the do not allow duplicate under validation tab in X12 agreement settings in biztalk admin console. In this case since the duplicate file will not come in to orchestration. In this case how
    can i acheive this.
    Thanks,
    Vijayan
    vijayan

    For both cases, the filename can be found on the FILE.ReceivedFileName Context Property.  You can access this Property in a Pipeline Component or Orchestration and take any action you want, such as apply to a database.
    The value is accessed by: MyReceivedMessage(FILE.ReceivedFileName)
    In the case of a duplicate EDI Interchange, you would use the Failed Message Routing feature to capture the error message with either an Orchestration or Send Port.

  • Using store procedure within sql statement?

    I have the following sample tables:
    project id project_name
    ====== ===============
    1          project one
    2          project two
    3           project three
    employee_id     fname          lname
    =========== =============     =====
    100          amy          A
    200          better          B
    300          carrie          C
    project_id     employee_id
    ===========     ===========
    1          200
    2          300
    3          100
    there is a procedure getFullname(empployee_id) in place that combines the fname with lname to full name
    what i need to accomplish is the following.
    project is created by employee
    ==============================
    project one is created by better b
    project two is created by carrie C
    project three is created by amy A
    but the rule is: you have to call the procedure getFullName(employee_id) to accomplish the task above, and don't use the join tables to get the full employee name

    CREATE OR REPLACE FUNCTION YOUR_FUNCTION(i_nEmpId IN NUMBER)
    RETURN VARCHAR2 IS
    BEGIN
      RETURN 'Lastname ' || TO_CHAR(i_nEmpId) || ' Firstname';
    END;
    WITH PROJECTS AS (SELECT 1 PROJECT_id, 'project one' PROJECT_NAME FROM DUAL
                      UNION ALL
                      SELECT 2 PROJECT_id, 'project two' PROJECT_NAME FROM DUAL
                      UNION ALL
                      SELECT 3 PROJECT_id, 'project three' PROJECT_NAME FROM DUAL
      PROJ_TO_EMP AS (SELECT 1 PROJ_ID, 100 EMP_ID FROM DUAL
                      UNION ALL
                      SELECT 2 PROJ_ID, 200 EMP_ID FROM DUAL
                      UNION ALL
                      SELECT 3 PROJ_ID, 300 EMP_ID FROM DUAL
    SELECT PROJECT_ID,
           PROJECT_NAME,
           EMP_ID,
           YOUR_FUNCTION(EMP_ID),
           PROJECT_NAME || ' is created by ' || YOUR_FUNCTION(EMP_ID)
      FROM PROJECTS,
           PROJ_TO_EMP
    WHERE PROJECT_ID=PROJ_ID;

  • 10g BLOB/CLOB can we store more than 4k in SQL

    Dear Friends
    I know we had issues with BLOB and CLOB storing more than 4k in Oracle 8i using SQL. Is it the same in 10g BLOB/CLOB can we store more than 4k in SQL?
    Please help me with some documentationw which explains these aspects with CLOB and BLOB in 10g
    Thanks
    Farouk

    Thanks for your help,
    I understand we can store blobs more than 4k in 10g using DBMB_LOG but there is a constraint in 8i that using SQL u can store directly only 4k and using a bind variable in PL/SQL we can store upto 32K. Is that the same in 10g or can we store directly using sql more than 4k?
    Thanks
    Farouk

Maybe you are looking for

  • Database, custom step types, ann XML report issues...All in one

    TS3.0 Have a number of issues to do the above. I'll try and explain them in order. I'm sure there all linked, but can't figure out how... The "Custom" Steps.....They are copies of the NI Numeric/Multiple Numeric tests, with a added post step to trans

  • Rendering causes a clip to go out of sync

    I can't figure this one out. I'm working with DVCPro HD 720p b-roll in an HDV 1080i60 sequence. The main interview is HDV, hence the sequence matches that. Most of the b-roll is fine, but there is one clip that, when rendered, goes way out of sync. B

  • NW ABAP Sneak Preview and Mini SAP online license works again

    The online license procedure for the NetWeaver ABAP Sneak Preview and Mini SAP systems at www.sap.com/minisap works again. Sorry for the inconvenience. Dirk

  • Ipad mini retina problem

    Hey guys i just bought the ipad mini retina and i got an issue ...the imovie and keynote app dont download its says downloading but its not moving theres nothing to do :(  what can i do ???

  • Instantiation Error in JAR file

    I have a Sybase database using jConnect-5_5. When I run the main class directly -- java MainClass arguments -- it works fine. Then I try creating a JAR file. The manifest file reads: Main-Class: MainClass Class-Path: path to jconn2.jar But when I run