To run mutipal SQLs in one procedure / function

Hi,
First of all, your help and efforts will be highly appreciated!
I am new to the Oracle world and learning to write PL/SQL with real world problems.
This is what I am facing now:
I have a bunch of SQL scripts need to run several times a year, they are simple and just to create/rebuild indexes on different tables. samples as below
CREATE INDEX ST_CODE_INDX_JAN2013 ON TREE_JAN2013
(CODE)
NOLOGGING
TABLESPACE ST_LRG_INDX
PCTFREE    10
INITRANS   2
MAXTRANS   255
STORAGE    (
            INITIAL          64K
            MINEXTENTS       1
            MAXEXTENTS       UNLIMITED
            PCTINCREASE      0
            FREELISTS        1
            FREELIST GROUPS  1
            BUFFER_POOL      DEFAULT
NOPARALLEL;
CREATE UNIQUE INDEX ST_ID_INDX_JAN2013 ON RECORDS_JAN2013
(M_ID)
NOLOGGING
TABLESPACE ST_LRG_INDX
PCTFREE    10
INITRANS   2
MAXTRANS   255
STORAGE    (
            INITIAL          64K
            MINEXTENTS       1
            MAXEXTENTS       UNLIMITED
            PCTINCREASE      0
            FREELISTS        1
            FREELIST GROUPS  1
            BUFFER_POOL      DEFAULT
NOPARALLEL;
And in total we probably will need to run around 100 scripts like this every time. Basically what we are doing is to import new tables every time and recreate/rebuild indexes. As you may see in the sample scripts above, all tables keep the same suffix but different table names. So, for now, what we are doing is to manually modify the script to reflex changes then kick it off.
Now, how can I create a procedure/function stored in database and waiting for a EXEC command to pass the suffix and then run automatically?
Once again, appreciated your great help!

Use DBMS_STATS package instead of 'analyze'.  'ANALYZE' is deprecated and may not exist in future releases.
Again - what you are trying to do (build tables/indexes on the fly) is extremely wrong.
Add a DATE column and keep everything in one table.  You can then just add the PARTITION clause for EE instances.
(against my better judgement)
Two methods exist to run dynamically generated DDL statements:
EXECUTE IMMEDIATE
DBMS_SQL -- I'm not 100% sure on this one. read the manual.
If you are dynamically generating the SQL, help limit SQL Injection by using DBMS_ASSERT on any user provided input.

Similar Messages

  • How to run a SQL Server Stored Procedure

    I need to run a SQL Server Stored Procedure in answer, the stored procedure use a hash table (temporary table) and I nedd to pass a parameter to stored procedure
    anyone know if is it possible in OBIEE, if yes how.
    thank you
    max

    thank you, but I'm not understand what you mean. I need to run this command in answer "direct access database"
    exec storedprocedure 1,1,1
    if I run this I receive thi error:
    error : [nQSError: 16001] ODBC error state: S0002 code: 208 message: [Microsoft][ODBC SQL Server Driver][SQL Server]object name '#TempList' not valid.. [nQSError: 16002] Cannot obtain number of columns for the query result. (HY000).
    here is the code of stored procedure:
    ROC [dbo].[GetOrderListmax]
    @OrderList varchar(500)
    AS
    BEGIN
    SET NOCOUNT ON
    CREATE TABLE #TempList
    OrderID int
    DECLARE @OrderID varchar(10), @Pos int
    SET @OrderList = LTRIM(RTRIM(@OrderList))+ ','
    SET @Pos = CHARINDEX(',', @OrderList, 1)
    IF REPLACE(@OrderList, ',', '') <> ''
    BEGIN
    WHILE @Pos > 0
    BEGIN
    SET @OrderID = LTRIM(RTRIM(LEFT(@OrderList, @Pos - 1)))
    IF @OrderID <> ''
    BEGIN
    INSERT INTO #TempList (OrderID) VALUES (CAST(@OrderID AS int)) --Use Appropriate conversion
    END
    SET @OrderList = RIGHT(@OrderList, LEN(@OrderList) - @Pos)
    SET @Pos = CHARINDEX(',', @OrderList, 1)
    END
    END
    SELECT o.OrderID, CustomerID, EmployeeID, OrderDate
    FROM dbo.Orders AS o
    JOIN
    #TempList t
    ON o.OrderID = t.OrderID
    END

  • How to run multiple sqls in one jasper report

    Hello!
    Is there any one that can help me in integrating/ viewing my xml file to the web. I have my GUI in jsp format, the jsp makes a call to the bean class and then finally bean class hit my reports java class.The report java class generates the report and shows it in the new window.
    The problem is with writing mutiple sql queries and showing the result from multiple sql queires in one report.
    I do not know how to write multiple queries for just 1 report. I can give a simple example of my problem also.
    My report is as follows:
    First Name Middle Name Last name
    Sandeep               Pathak
    Now First and Middle Name come from 1st sql query and Last Name comes from 2nd sql query.
    I want to join the result obtained from both the sql queries in one Jasper Report (not as 2 separate sections but as one section).
    My problem is how to view my report in the web. furthermore, how to make complex query in jasperassistant, like multiple table in one query, because i�m integrating multiple query in one form or sheets of paper.
    Please help me in this.
    Thanks
    Sandeep
    Calance
    India

    Hi Sheldon,
    we never have issues when we combine standard objects, like a cliear with a load inforprovider, or the master data integration you mentioned in your document. However, from the moment we combine a script logic with a standard package (like a move) it does not work .The data package contains the task needed for the script and for the move. the process chain is called up but always comes in error in the first step (BPC modify dynamically ) ... there is also no log when checking the view status ...
    I can sent you some screenshots if you like ...
    D

  • How to run a SQL server store procedure from Apex (oracle)?

    Our application needs to call a store procedure in the SQLserver database. The sotre procedure works fine in the SQL server side. However, when I tried to call the store procedure in TOAD as:
    exec my_store_procedure(para1, para2);
    I kept getting the error message:
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'my_store_procedure'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    I have searched online but couldn't find the solution. This is an emergency, so prompt reply is Highly Appreciated!
    Luc

    How is Oracle connecting to the SQL Server?
    With the Transparent Gateway or Generic Connectivity?
    I don't think that Generic Connectivity supports stored procedures.
    The documentation for Heterogeneous Connectivity is here:
    http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14232/toc.htm
    You'd probably get better answers from the Heterogeneous Connectivity forum:
    Heterogeneous Connectivity

  • Running a SQL Server Stored Procedure in JSP

    Hi peoples!
    I have a whole heaps of stored procedure sitting in a SQL Server database I need to make use of.
    Im not sure of the code I need to use to access them, and display information from them.
    Thanks a heap

    You Need to set up a connection object like thus:
    Connection conn1 = DriverManager.getConnection("jdbc:odbc:NameOfDatabase", "UserName", "Password");
    and then call the following:
    CallableStatement cs = conn1.prepareCall("{call spHowMyTeamPerforms(?, ?)}");
    cs.setString(1, TeamId);
    cs.setInt(2, viewId);
    ResultSet result2 = cs.executeQuery();
    As you can see I have a stored procedure called spHowMyTeamPerforms which expects two parameters, which explains the bumpf underneath.
    Look through the tutorials about PreparedStatements and Callable statements as well

  • SQL Developer Bug: NVL() function error when debug/run stored procedure

    Version:
    SQL Developer: 1.5.3 (build main-5783)
    Oracle DB connected: Oracle9i Enterprise Edition Release 9.2.0.6.0
    Stored procedure code like this:
    procedure search(V_STATUS_IN IN CHAR(1)) is
    begin
    declare
    V_STATUS CHAR(1) := NULL;
    begin
    V_STATUS := NVL(V_STATUS_IN, '%'); -- error line
    end;
    end;
    The stored procedure runs well (I mean no oracle exception) when called through Java code (and in TOAD). But when debug/run in SQL Developer, following error at the error line:
    $Oracle.EXCEPTION_ORA_6502:
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    --------------------------------------------------*/

    What parameter are you passing in? It is possible you are trying to cram a multibyte character into a singlebyte container. What are the nls settings for the database and for sqldeveloper?

  • Procedure runs in SQL Plus, but not when called from my Oracle Form

    Hi. I have this code to send an email alert as the user updates a record on my base table from my Oracle Form. I use dbms_scheduler so that it's submitted as a background job and so the email processing does not delay my Oracle Form from saving quickly. If I submit this code in SQL Plus it executes and I receive the email as expected.
    begin
    dbms_scheduler.create_job ( 
         job_name            => 'IMMEDIATE_JOB', 
         job_type            => 'PLSQL_BLOCK', 
         job_action          => 'begin TTMS.dropperVacationConflict_Notify (62547, ''01-SEP-11'', ''02-SEP-11''); end;', 
         number_of_arguments => 0, 
         start_date          => sysdate +1/24/59, -- sysdate + 1 minute 
         enabled             => TRUE, 
         auto_drop           => TRUE, 
         comments            => 'Immediate, one-time run');
    end;However if I submit this code from a Post-Update trigger in my form the code runs without error, but my email is never received (the same parameter values would be passed to this trigger):
    begin
    -- Submit the email notification in the background so as to not slow down the screen while saving.   
    dbms_scheduler.create_job ( 
         job_name            => 'IMMEDIATE_JOB', 
         job_type            => 'PLSQL_BLOCK', 
         job_action          => 'begin TTMS.dropperVacationConflict_Notify (:dropper_vacations.dropper_id, :dropper_vacations.begin_dt, :dropper_vacations.end_dt); end;', 
         number_of_arguments => 0, 
         start_date          => sysdate +1/24/59, -- sysdate + 1 minute 
         enabled             => TRUE, 
         auto_drop           => TRUE, 
         comments            => 'Immediate, one-time run');
    end;     Any ideas why this might be happening?

    Wow, so I changed the two procedures so that I'm only passing in one number parameter and one char parameter...
    CREATE OR REPLACE procedure TTMS.job_vacationconflict_notify (p_dropper_id number, p_other char) IS
    CREATE OR REPLACE PROCEDURE TTMS.dropperVacationEmailURL_new (in_dropper_id number, in_other char) ISIf I execute it like this it works and I get the email:
    TTMS.job_vacationconflict_notify(62547, 99999);or like this it works and I get the email:
    TTMS.job_vacationconflict_notify(62547, '99999');But if I execute it like this (I get no errors) the email is not sent:
    TTMS.job_vacationconflict_notify(62547, 'ababa');So this problem really has nothing to do with date formats. It seems to have to do with whether parameter two has characters in it!!! What the heck.
    Any ideas on this?
    Here is the procedure I'm calling:
    CREATE OR REPLACE procedure TTMS.job_vacationconflict_notify (p_dropper_id number, p_other char) IS
    begin
      dbms_scheduler.create_job ( 
         job_name            => 'IMMEDIATE_JOB', 
         job_type            => 'PLSQL_BLOCK', 
         job_action          => 'begin TTMS.dropperVacationemailurl_new ('||p_dropper_id||','||p_other||'); end;', 
         number_of_arguments => 0, 
         start_date          => sysdate +1/24/59, -- sysdate + 1 minute 
         enabled             => TRUE, 
         auto_drop           => TRUE, 
         comments            => 'Immediate, one-time run');
    end;
    /And the above procedure is calling this procedure which should be sending the email alert:
    CREATE OR REPLACE PROCEDURE TTMS.dropperVacationEmailURL_new (in_dropper_id number, in_other char) IS
          myguid varchar2(15):=null;
          pcm_contact varchar2(3):=null;
          guid_contact varchar2(15):=null;
          conflict_cnt number(8):=0;
          -- Various declarations
          PSENDER VARCHAR2(200);            --  From
          PRECIPIENT VARCHAR2(200);         --  To
          P_CC_RECIPIENT VARCHAR2(200);     --  CC
          P_BCC_RECIPIENT VARCHAR2(200);    --  BCC
          PSUBJECT VARCHAR2(200);           --  Subject
          PMESSAGE VARCHAR2(6000);          --  Message Body
          PPARAMETER NUMBER;                --  Parameter Value
          guid_valid varchar2(15);          --  Used to grab the validation value of
          -- Grab name details of e-mail targets
          cursor targets is
          select guid, initcap(first_name) first_name, initcap(first_name)||' '||initcap(last_name) fullname
          from pwc_employee
          where upper(guid) = upper(guid_contact);
    BEGIN
            select count(*)
            into conflict_cnt
            from dropper_bundle_assign
            where
                dropper_sched = in_dropper_id and
                trunc(sched) <> '31-DEC-29' AND        
                trunc(sched) between '01-SEP-11' and '02-SEP-11' and
                trunc(sched) > trunc(sysdate);
            select distinct pcm
            into pcm_contact
            from dropper_bundle_assign
            where
                  dropper_sched = in_dropper_id and
                  trunc(sched) <> '31-DEC-29' AND        
                  trunc(sched) between '01-SEP-11' and '02-SEP-11' and
                  trunc(sched) > trunc(sysdate);
            select guid
            into guid_contact
            from pwc_employee
            where initials = pcm_contact;
        -- Ensure required parameters have been passed
        if guid_contact is not null
           and in_dropper_id is not null then
               Begin
                    select guid
                    into guid_valid
                    from pwc_employee
                    where upper(guid) = upper(guid_contact);
               Exception
                    when no_data_found then
                    raise_application_error(-20000,'Invalid Recipient.  Please check the employee table.  Please try again.');
               End;
               -- In the event there are multiple targets then we will loop thru and send individual emails
               for thisone in targets loop
                    PSENDER := lower(user)||'@us.ibm.com';
                    PRECIPIENT := lower(thisone.guid)||'@us.ibm.com';
                    P_CC_RECIPIENT := lower(thisone.guid)||'@us.ibm.com';
                    P_BCC_RECIPIENT := 'ssbuechl'||'@us.ibm.com';
                    PPARAMETER := TO_NUMBER(lower(in_dropper_id));
                    PSUBJECT := 'TEST: Dropper Vacation '||in_other||' Conflict Notification for dropper '||in_dropper_id||' - Action Required';
                    PMESSAGE := thisone.first_name||'-<br><br>There is an induction conflict due to a new or updated dropper vacation.<br><br>Click here to the dropper''s vacation conflicts: <u><a href="http://9.35.32.205:7777/forms/frmservlet?config=TTMSMENU&form=dropper_vacations&otherparams=p_dropper='||PPARAMETER||'">Dropper Id: '||PPARAMETER||'</a></u> (note: use your Oracle credentials when prompted for log-on information).<br><br>Thanks.';
                    SEND_MAIL ( PSENDER, PRECIPIENT, P_CC_RECIPIENT, P_BCC_RECIPIENT, PSUBJECT, PMESSAGE );  -- Procedure to physically send the e-mail notification
               end loop;
        else
              raise_application_error(-20001,'Recipient and Parameter Value are required. Please try again.');
        end if;
    exception
        when no_data_found then
             raise_application_error(-20002,'Note: Email will not be sent because no PCM was identified as the manager or the PCM does not have a record in the Employee table.  See ITS for assistance.');
         when too_many_rows then
             raise_application_error(-20003,'Note: Email will not be sent because multiple PCMs manage this dropper. Please notify each PCM manually.');
    END dropperVacationEmailURL_new;
    /Edited by: sharpe on Aug 17, 2011 4:38 PM
    Edited by: sharpe on Aug 17, 2011 5:03 PM

  • SQL Procedure working when run manually, not running from sql server agent

    I have a procedure that runs fine using the execute command in SSMS, however putting the same command in a job gives the following error.
    line 9, character 9, unexpected end of input
    The code takes a very long XML string in UTF-8 encoding and puts it into a single nvarchar(max) cell. Then puts this string into a XML cell in a different table, allowing me to query the individual parts of the XML code using the nodes function. I cannot put
    the data directly into a nvarchar cell due to encoding differences.
    I can't reproduce the string here as it is very very long.
    I'm just looking for ideas really as to where it might be going wrong.
    Here is what I know so far:
    The procedure runs without issue when executed manually
    I have checked permission issues, and that doesn't seem to be the problem. The agent runs under my own account and I am a sysadmin on the database
    I split the procedure into seperate parts to locate exactly where the problem is occuring. Once again the seperate procedures run fine when executed manually but an error occurs when run through SQL Server agent.
    When the query is run seperately through SQL Server Agent it gives a slightly different error. This leads me to believe it is an encoding issue. However I am getting the XML from a webpage and I can't change the encoding on the webpage.
    line 1, character 38, unable to switch the encoding
    I know this is a long shot since you can't replicate the issue but if anyone could give an idea as to where to start looking for an answer, it would be greatly appreciated.

    Here's how I'm taking the XML data and putting it into an nvarchar(max) column (Column Name TEXT):
    Select @url = 'http://....'
    EXEC @hr=sp_OACreate 'WinHttp.WinHttpRequest.5.1',@win OUT
    IF @hr <> 0 EXEC sp_OAGetErrorInfo @win
    EXEC @hr=sp_OAMethod @win, 'Open',NULL,'GET',@url,'false'
    IF @hr <> 0 EXEC sp_OAGetErrorInfo @win
    EXEC @hr=sp_OAMethod @win,'Send'
    IF @hr <> 0 EXEC sp_OAGetErrorInfo @win
    INSERT #TextData(TEXT)
    EXEC @hr=sp_OAGetProperty @win,'ResponseText'
    IF @hr <> 0 EXEC sp_OAGetErrorInfo @win
    EXEC @hr=sp_OADestroy @win
    IF @hr <> 0 EXEC sp_OAGetErrorInfo @win

  • Unable to Integrate to BC4J Components & Running PL/SQL Procedure

    I recently shifted to bc4j technology.
    i am having problem in calling one application module from
    another application module, using same transaction context.
    Another problem is running pl/sql procedure from doDML method of
    entity object, i also want to pass user's input to these
    procedures.

    Anant,
    If you want to call one application module from another, you
    should nest them in a root application module. The documentation
    describes how to nest application modules; basically you select
    the Application Modules tab in the application module editor.
    Nested application modules all share the transaction context of
    the root app module, so when you call one app module from another
    you're automatically using the same transaction context.
    The Oracle9i JDeveloper Release Candidate (which you can download
    from OTN) contains a sample that calls a PL/SQL stored procedure
    from BC4J. It's in <jdev_home>\BC4J\samples\StoredProc.
    Blaise

  • SqlPlus or PL/SQL -- how to copy one procedure with one command?

    Hello,
    In this scenario, I have 11g on server1 and server2.
    Using SqlPlus or a PL/SQL procedure, I want to issue a command to copy a procedure now on server1 over to a new identical server and tablespace called server2.
    Would someone please help me with the syntax of this copy command?
    On server2 I tried something like this:
    create procedure tablespace1.procname from tablespace1.procname@dblink_server1
    Note that I want to avoid using imp or datapump, etc. I want this to be a simple copy of one procedure by name from another server.
    Any suggestions are greatly appreciated. Thank you.

    Thank you.
    Below, line 1 method returns a 'create table...' statement:
    1> select dbms_metadata.get_ddl ('TABLE','table_name','schema_name') FROM dual
    This works well, especially for tables, but I still cannot figure out how to do it across a database link.
    The next method, line 2, works well for procedures, but not for tables:
    2> select name, type, line, text from user_source where type='PROCEDURE' ORDER BY NAME,LINE
    One way or another, I am trying to get the source from selected remote servers and then use it to create the same objects on other remote servers.
    Any suggestions are greatly appreciated.
    Live long and prosper.

  • SQL query statement  for stored procedure / function listing ...

    Hi everyone,
    Is there a SQL query to list all the stored procedures and functions of an user in an Oracle 8 database?
    I have this idea:
    select * from USER_SOURCE where TYPE = 'PROCEDURE' or TYPE = 'FUNCTION'
    but I am not too sure whether this is correct.
    Thanks in advance,
    Eric

    Yeah
    I agree with you Garcia , my above posting was a correction to the query mentioned in the question only.
    you are correct
    If you only want the name of the object,
    SELECT Object_Name from User_Objects where object_type in ( 'PROCEDURE' ,'FUNCTION');
    is much faster than Selecting (distinct) from User_Source.

  • Sql Developer - View source code of procedures, functions & packages in another schema

    Our developers need the ability to view procedures, function, packages etc. in the production database (using SQL DEVELOPER).  They don't have access to sign on as the owner of these
    objects in Production.  They must use their own limited access UserID for this purpose.
    This limited access UserID has been granted select privilege on DBA_SOURCE & DBA_OBJECTS.  The developers need the ability to view the source of these object via
    the tree view in SQL DEV.  They should be able to click on "other users" in the SQL DEV tree view and see a listing of the owner schema objects.  Then they should
    be able to select the desired object and view the source code.  These developers are used to using GUI interfaces.  Selecting from DBA_SOURCE would not be an
    option for them.
    I understand that if the limited user is granted SELECT ANY DICTIONARY or SELECT_CATALOG_ROLE then this functionality will work.  The problem is those
    privileges/roles  provide much more access than should be granted to these limited access users. Granting DBA to these users is also not an option.
    In TOAD and other end-user tools this functionality works when only select privilege on DBA_SOURCE & DBA_OBJECTS has been granted.  We need this same functionality
    in SQL DEV.
    While searching this forum and the internet, I see that other installations have this same issue.
    Please enhance SQL Developer with this functionality. 
    Thank you, ellen

    Just to double check that I'm interpreting the problem correctly, is the following true:
    select * from all_objects where object_name = 'DBA_SOURCE'
    returns nothing
    select * from dba_source where name = your PL/SQL module
    returns all the code

  • Parameter index move while executing PL/SQL stored procedure/function

    Hello, community.
    Have a question for you. It looked like very easy to write some small JDBC-wrapper to handle stored procedure/functions call for Oracle.
    Here is the code snippet of it:
    import java.io.Serializable;
    import java.sql.CallableStatement;
    import java.sql.Connection;
    import java.sql.SQLException;
    import java.util.HashMap;
    import java.util.Iterator;
    import javax.sql.DataSource;
    import oracle.jdbc.driver.OracleTypes;
    import org.apache.log4j.Logger;
    public class SmallHelper {
         public static final int CALL_TYPE__PROCEDURE = 1;
         public static final int CALL_TYPE__FUNCTION = 2;
         public static final int PARAMETER__IN = 1;
         public static final int PARAMETER__OUT = 2;
         private static final Logger log = Logger.getLogger(SmallHelper.class);
         private Connection con = null;
         private CallableStatement statement = null;
         private String name;
         private int type;
         private int resultType;
         private HashMap arguments = new HashMap();
          * Creates connection using data source as parameter.
          * @param ds - data source
          * @throws EhlApplicationException
         public SmallHelper(DataSource ds) throws Exception {
           try {
                   con = ds.getConnection();
              catch (SQLException e) {
                   ExceptionHelper.process(e);
         public void registerProcedure(String name) {
              this.name = name;
              this.type = CALL_TYPE__PROCEDURE;
         public void registerFunction(String name, int resultType) {
              this.name = name;
              this.resultType = resultType;
              this.type = CALL_TYPE__FUNCTION;
          * NB! When You're dealing with stored function index should start with number 2!
         public void registerArgument(int index, Object value, int type, int inOutType) {
              arguments.put(new Long(index), new CallableStatementArgument(value, type, inOutType));
         private String getSQL() {
              StringBuffer str = new StringBuffer("{ call  ");
              if ( type == CALL_TYPE__FUNCTION )
                   str.append(" ? := ");
              str.append(name).append("( ");
              for ( Iterator i = arguments.values().iterator(); i.hasNext(); ) {
                   i.next();
                   str.append("?");
                   if ( i.hasNext() )
                        str.append(", ");
              str.append(") }");
              return str.toString();
         public void execute() throws SQLException{
              String query = getSQL();
              statement = con.prepareCall(query);
              if ( type == CALL_TYPE__FUNCTION )
                   statement.registerOutParameter(1, resultType);
              for ( Iterator i = arguments.keySet().iterator(); i.hasNext(); ) {
                   Long index = (Long) i.next();
                   CallableStatementArgument argument = (CallableStatementArgument) arguments.get(index);
                   int type = argument.getType();
                   if ( argument.getInOutType() == PARAMETER__OUT )
                        statement.registerOutParameter(index.intValue(), type);
                   else if ( type != OracleTypes.CURSOR )
                        statement.setObject(index.intValue(), argument.getValue(), type);
              log.info("Executing SQL: "+query);
              statement.execute();
         public CallableStatement getStatement() {
              return statement;
         public void close() throws EhlApplicationException {
              try {
                   if (statement != null)
                        statement.close();
                   if (con != null)
                        con.close();
              catch (SQLException e) {
                   EhlSqlExceptionHelper.process(e);
         private class CallableStatementArgument implements Serializable{
              private Object value;
              private int type;
              private int inOutType;
              public CallableStatementArgument(Object value, int type, int inOutType) {
                   this.value = value;
                   this.type = type;
                   this.inOutType = inOutType;
              public int getType() {
                   return type;
              public Object getValue() {
                   return value;
              public int getInOutType() {
                   return inOutType;
    }It was really done in 10-15 mins, so don't be very angry at code quality :)
    Here is the problem.:
                   helper.registerProcedure("pkg_diagnosis.search_diagnosis");
                   helper.registerArgument(1, null, OracleTypes.CURSOR, EhlJdbcCallableStatementHelper.PARAMETER__OUT);
                   helper.registerArgument(2, pattern, OracleTypes.VARCHAR, EhlJdbcCallableStatementHelper.PARAMETER__IN);
                   helper.registerArgument(3, lang, OracleTypes.VARCHAR, EhlJdbcCallableStatementHelper.PARAMETER__IN);
                   helper.registerArgument(4, EhlSqlUtil.convertSetToString(langs, ","), OracleTypes.VARCHAR, EhlJdbcCallableStatementHelper.PARAMETER__IN);
                   helper.registerArgument(5, EhlSqlUtil.convertSetToString(diagnosisClass, ","), OracleTypes.VARCHAR, EhlJdbcCallableStatementHelper.PARAMETER__IN);
                   helper.registerArgument(6, parentId, OracleTypes.NUMBER, EhlJdbcCallableStatementHelper.PARAMETER__IN);
                   helper.execute();
                   ResultSet rs = ((OracleCallableStatement) helper.getStatement()).getCursor(1);
                   procedure definition:
    procedure search_diagnosis (l_res OUT dyna_cur,
                               in_search_string IN VARCHAR2,
                               in_search_lang IN VARCHAR2,
                               in_lang_list IN VARCHAR2,
                               in_diag_class_list IN VARCHAR2,
                               in_parent_id IN NUMBER) Procedure call has inner check that fail because of som strange reason:
    in_search_string has 2 as index, that is correct. but procedure recieves is as number 3 in parameter list (what is in_search_lang). Other parameters are moved to. It seems like a cursor takes 2 places in definition. It's clear that if I put in_search_string as 1 parameter and cursor as 0 I'll get invalid parametr bindong(s) exception. So... any ideas why 2nd parameter is actually 3rd?
    Thanks beforehand.

    hmm...moreover:
    if we change procedure to function and call it in a simple way:
    CallableStatement stmnt = helper.getConnection().prepareCall("begin ? := pkg_diagnosis.search_diagnosis(?,?,?,?,?); end;");
                   stmnt.registerOutParameter(1, OracleTypes.CURSOR);
                   stmnt.setString(2, pattern);
                   stmnt.setString(3, lang);
                   stmnt.setString(4, langs);
                   stmnt.setString(5, diagnosisClass);
                   stmnt.setObject(6, parentId, OracleTypes.NUMBER);
                   stmnt.execute();
                   ResultSet rs = (ResultSet) stmnt.getObject(1);the exception is:
    [BEA][Oracle JDBC Driver][Oracle]ORA-06550: line 1, column 14:
    PLS-00382: expression is of wrong type
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignoredif we return some string or number - it works. but when we want cursor back - it fails.
    cursor is defined like ordinary dynamic cursor:
    TYPE dyna_cur IS REF CURSOR;

  • Encryption of pl/sql package/procedures/function code

    Is it possible to make the code inside a package/procedure/function un readable to other users.
    As is some of the api package body code in portal ?
    thanks in anticipation.
    SD,

    PL/SQL Wrap Utilityhttp://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96624/c_wrap.htm#LNPLS016
    Note, however that you cannot revert back to original un-wrapped code from a code that has been wrapped. You would need access to the original source files to get the original source code.

  • Can a SQL Server stored procedure call an SAP function module?

    Can a SQL Server stored procedure call an SAP function module.? The stored procedure will be called via a trigger when data records are added to a Z table.

    You have two options:
    - the other software can use the RFC SDK and call directly in the system
    - the other software can use a database connect
    Markus

Maybe you are looking for

  • Unable to open CATS link through Portal...

    Hi Guys, I am unable to open the CATS Link through Portal. Once I click the link "Record working time", Iam getting error message i.e: 500   Internal Server Error SAP NetWeaver Application Server 7.00/Java AS 7.00  Failed to process request. Please c

  • Any guess on how long it will take for HP to come up with laserjet printer drivers for LION?

    HP does not have the printer drivers available for the Mac OSX 10.7 (LION) for the HP Laserjet 2420/2430 series; which has been true for previous OSX releases also?  Just wondering if it's 1-3 months, or more before our printers can be expected to wo

  • Problem with XML signature

    Can anybody tell me how to generate an xml signature with the base 64 transform(Transform.BASE64)? I just can't find any documentation on the web. It would be great to provide a small code exemple. Thanks Antoine

  • Recurring Inspection - QM

    Hi All, I am trying to create inspection lot from QA07. My selection items include material , plant , batch and from "additional goods movement" tab I have selected "lot creation only" and Initial run in days "1". But inspection lot is not creating a

  • WAAS 7341 uanble to optimize application runnnig with browser IE7

    Hi, I'm having Cisco WAAS 7341 with version 4.1.5.F Aplication running on browser IE7 are unable to optimize the connection on WAAS where as the application running on browser IE6 are able to optimize the connection on WAAS.I do not find any bugs rel