compilation of stored procedure

The procedure can be stored below.

I need to declare varchar2 with a number such as varchar2 (30)
How can I do and how to compile the stored procedure to display the output.

number variable t1
date variable t2

test exec ('345', 'test', 'ECE','' 2008-09-10: t1: t2);

I am facing problems




Create or REPLACE procedure (eno vARCHAR2
ename VARCHAR2
dept VARCHAR2
Join_date DATE
sno ON NUMBER
End_date DATE
)
IS

BEGIN

SELECT SNO, end_date IN sno, end_date of EMPLOYEE

WHERE EMPLOYEE_NO = eno;



EXCEPTION

WHEN NO_DATA_FOUND THEN
SNO: = NULL;
End_date: = NULL;

WHILE OTHERS THEN
SNO: = NULL;
End_date: = NULL;

END;
/

Your case,

satyaki>
satyaki>ed
Wrote file afiedt.buf

  1  cREATE OR REPLACE PROCEDURE Sample (carrier_code vARCHAR2
  2  ,vessel_name VARCHAR2
  3  ,voyage_no  VARCHAR2
  4  ,port_code  VARCHAR2
  5  ,eta_date   DATE
  6  ,tmp_rotation OUT NUMBER
  7  ,tmp_eta_date OUT DATE
  8  )
  9  IS
 10  BEGIN
 11  SELECT ROTN,ETA_DATE INTO
 12  tmp_rotation,tmp_eta_date
 13  FROM Sample1
 14  WHERE LINE_CODE = carrier_code
 15  AND VESS_NAME = vessel_name
 16  AND VOYAGE_NO = voyage_no
 17  AND PORT_CODE = port_code
 18  AND SAIL_DATE IS NULL
 19  AND VOYAGE_TYPE = 0;
 20  EXCEPTION
 21  WHEN NO_DATA_FOUND THEN
 22  tmp_rotation := NULL;
 23  tmp_eta_date := NULL;
 24  WHEN OTHERS THEN
 25  tmp_rotation := NULL;
 26  tmp_eta_date := NULL;
 27* END;
 28  /

Procedure created.

Elapsed: 00:00:02.33
satyaki>
satyaki>

satyaki>
satyaki>declare
  2  t1 number(10);
  3  t2 date;
  4  begin
  5  Sample('MSK','DUBAI','5645','J',null,t1,t2);
  6  dbms_output.put_line('SNO: '||t1||' - '||' END_DATE: '||t2);
  7  exception
  8  when others then
  9  dbms_output.put_line(sqlerrm);
 10  end;
 11  /
SNO:  -  END_DATE:

PL/SQL procedure successfully completed.

Elapsed: 00:00:01.04
satyaki>
satyaki>
satyaki>
satyaki>SELECT ROTN,ETA_DATE
  2  FROM Sample1
  3  WHERE LINE_CODE = 'MSK'
  4  AND VESS_NAME = 'DUBAI'
  5  AND VOYAGE_NO = '5645'
  6  AND PORT_CODE = 'J'
  7  AND SAIL_DATE IS NULL
  8  AND VOYAGE_TYPE = 0;

      ROTN ETA_DATE
---------- ---------
    623930 23-APR-08

Elapsed: 00:00:00.16
satyaki>

And now to change your query to->

satyaki>
satyaki>cREATE OR REPLACE PROCEDURE Sample (carrier_code vARCHAR2
  2  ,vessel_name VARCHAR2
  3  ,voyage_no  VARCHAR2
  4  ,port_code  VARCHAR2
  5  ,eta_date   DATE
  6  ,tmp_rotation OUT NUMBER
  7  ,tmp_eta_date OUT DATE
  8  )
  9  IS
 10
 11  cursor c1
 12  is
 13    SELECT ROTN,ETA_DATE
 14    FROM Sample1
 15    WHERE LINE_CODE = carrier_code
 16    AND VESS_NAME = vessel_name
 17    AND VOYAGE_NO = voyage_no
 18    AND PORT_CODE = port_code
 19    AND SAIL_DATE IS NULL
 20    AND VOYAGE_TYPE = 0;
 21
 22    r1 c1%rowtype;
 23
 24  BEGIN
 25
 26  for r1 in c1
 27  loop
 28    tmp_rotation := r1.ROTN;
 29    tmp_eta_date := r1.ETA_DATE;
 30  end loop;
 31
 32  EXCEPTION
 33  WHEN NO_DATA_FOUND THEN
 34  tmp_rotation := NULL;
 35  tmp_eta_date := NULL;
 36  WHEN OTHERS THEN
 37  tmp_rotation := NULL;
 38  tmp_eta_date := NULL;
 39  dbms_output.put_line(sqlerrm);
 40  END;
 41  /

Procedure created.

Elapsed: 00:00:01.96
satyaki>
satyaki>
satyaki>declare
  2  t1 number(10);
  3  t2 date;
  4  begin
  5  Sample('MSK','DUBAI','5645','J',null,t1,t2);
  6  dbms_output.put_line('SNO: '||t1||' - '||' END_DATE: '||t2);
  7  exception
  8  when others then
  9  dbms_output.put_line(sqlerrm);
 10  end;
 11  /
SNO: 623930 -  END_DATE: 23-APR-08

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.17
satyaki>
satyaki>
satyaki>SELECT ROTN,ETA_DATE
  2  FROM Sample1
  3  WHERE LINE_CODE = 'MSK'
  4  AND VESS_NAME = 'DUBAI'
  5  AND VOYAGE_NO = '5645'
  6  AND PORT_CODE = 'J'
  7  AND SAIL_DATE IS NULL
  8  AND VOYAGE_TYPE = 0;

      ROTN ETA_DATE
---------- ---------
    623930 23-APR-08

Elapsed: 00:00:00.06
satyaki>

Hope this will help.

Kind regards.

LOULOU.

Tags: Database

Similar Questions

  • Compile with stored procedure errors

    Hi guys, I just start SQL so forgive me if I ask stupid questions real. That's the problem I have right now, as I said in my title.

    It's my procedure.sql

    CREATE OR REPLACE PROCEDURE check IS

    no_of_duplicates NUMBER: = 0;

    BEGIN

    SELECT COUNT (*) IN no_of_duplicates

    THE EMPLOYEE

    WHERE E # =.

    (select E # PILOT)

    WHERE THERE ARE

    (SELECT E # MECHANIC)

    WHERE DRIVER. L # = MECHANIC. L#));

    IF no_of_duplicates: = 0 THEN dbms_output.put_line ('OK');

    ON THE OTHER

    SELECT E #, NAME OF THE EMPLOYEE

    WHERE E # =.

    (SELECT E # PILOT)

    WHERE THERE ARE

    (SELECT E # MECHANIC)

    WHERE DRIVER. L # = MECHANIC. L#));

    END IF;

    END check;

    /

    While trying to create the procedure, it gives me compilation errors. I took with this for hours and can't seem to find anything wrong with it. Can someone point me in the right direction? Thank you!

    Hello

    Once again, your postal code.  The error occurs when you call the procedure, but you have not posted the code that calls the procedure and causes the error.

    When I do this in SQL * more:

    SET SERVEROUTPUT ON ENCAPSULATED FORMAT
    EXEC check;

    The procedure that you have posted works perfectly (i.e., displayed the e # is, exactly as it was designed to do).

    Display the e # and the name consists of BULK COLLECT both the e # name in separate collections, like this:

    CREATE OR REPLACE PROCEDURE check IS
    TYPE e #_table IS the TABLE OF THE employee.e#%TYPE;
    e # e _list #_table;

    TYPE name_table IS TABLE OF THE employee.name%TYPE;
    name_list name_table;
    BEGIN
    SELECT e #, name
    E LOOSE COLLECTION #_list, name_list
    The EMPLOYEE
    WHERE e # (IN)
    SELECT d.e #.
    DRIVER d
    JOIN m mechanic ON d.e # m.e = #.
    );
    E IF #_list. COUNT = 0
    THEN
    dbms_output.put_line ('OK, there without duplicate of illict");
    ELSE - that is to say, e #_list. COUNTY <> 0
    dbms_output.put_line (' the following employees are drivers and mechanics :');)
    J IN 1.e #_list. COUNTY LOOP - I displays parentheses sometimes hard on the OTN site
    dbms_output.put (TO_CHAR (e #_list (j)))
    '999999999999'
    )
    );
    dbms_output.put (' ');
    dbms_output.put_line (name_list (j));
    END LOOP;
    END IF;
    END check;
    /
    DISPLAY ERRORS

    This is the result I get when I run the procedure above with your sample data:

    The following employees are drivers and mechanics:

    1 John Smith

    You will notice I did several other changes in your code, sometimes because they are much more practical and sometimes just to show you different ways to do the same thing, that you may or may not want to use in this problem.

    For example, you were doing the same query (with only very slight differences) 2 times: once to get the no_of_duplicates and then a second time to get the actual data.  I don't know if it's the most effective way to do what you need.  Say that there are 1000 rows in the result.  You get all the 1000 once just to get the total number (that you do not need, if all you worry at this point is if there is), then to get the data.  When you make a COLLECTION in BULK, you get automatically the COUNTY anyway, so why not not COLLECTING in BULK, and then use this count to see what to do next.  If the NUMBER is greater than 0, then you already have the data, and you do not need to fetch it again.  In addition, repeating (essentially) the same code is a maintenance problem.  If you need to make a change, you must make the same change to several places.  At best, it's a pain; but it is the exactly the kind of mistake that is easy to miss in trials, and you could have the code that runs for weeks in Production before you notice that it sometimes gives false results.

    Another example: e # is a NUMBER.  If it is possible to convert numbers in VARCHAR2s and save these VARCHAR2s in a VARCHAR2 collection, would be unwise more just to store them in a collection of NUMBER?

  • error when you try to compile this stored procedure

    I get this error message

    Testing_sp PROCEDURE compiled
    WARNING: the execution is completed with warning

    can I do this...

    See the err;

    and:

    17/23 PL/SQL: ORA-00932: inconsistent data types: expected NUMBER obtained -
    16/1 PL/SQL: statement ignored

    I can't understand why.
    I checked all the columns at TEST_TMP_TBL
    they are all varchar2





    CREATE OR REPLACE PROCEDURE testing_sp
    AS

    XML CLOB.
    xml2 VARCHAR2 (150);

    BEGIN


    SELECT ' <? XML version = "1.0" encoding ="' | utl_i18n.map_charset (value) | "" ? > '
    IN xml2
    OF nls_database_parameters
    Setting WHERE = 'NLS_CHARACTERSET ";


    SELECT
    XMLElement ("APPLICATION",
    XMLAttributes ('TEST', "Name")
    , XMLElement ("TESTPAGE",
    XMLAgg)
    XMLElement ("PROJ",
    XMLAttributes (NVL("ORDERS",' ') AS ORDERS,
    NVL("SUB_PART",' ') AS SUB_PART,
    NVL("SUB_SUB",' ') AS SUB_SUB,
    NVL("DESC",' ') AS DESC,
    NVL("ADD",' ') AS ADD,
    NVL("NUMB",' ') YOU NUMB
    ),

    XMLForest)
    NVL("ORDERS",' ') STOPPED,
    NVL("SUB_PART",' ') AS SUB_PART,
    NVL("SUB_SUB",' ') AS SUB_SUB,
    NVL("DESC",' ') AS DESC,
    NVL("ADD",' ') AS ADD,
    NVL("NUMB",' ') YOU NUMB
    )
    )
    )
    )
    )
    in xml
    OF TEST_TMP_TBL;



    DBMS_XSLPROCESSOR.clob2file (xml2: xml, 'dir', 'testing.xml');



    EXCEPTION
    while others then
    Rollback;

    end;



    Let me know if you have an idea, I would almost give my first born of an answer to this (not really sure)

    SQL > DECLARE
    2 v_xml CLOB.
    3 - v_xml XMLTYPE.
    4 BEGIN
    5 SELECT XMLELEMENT ("Emp") IN v_xml FROM DUAL;
    6 DBMS_OUTPUT. Put_line (v_xml);
    7 END;
    8
    9.
    SELECT XMLELEMENT ("Emp") IN the v_xml FROM DUAL;
    *
    ERROR on line 5:
    ORA-06550: line 5, column 21:
    PL/SQL: ORA-00932: inconsistent data types: expected NUMBER obtained -
    ORA-06550: line 5, column 2:
    PL/SQL: SQL statement ignored

    now change the variable for XMLTYPE data type;
    SQL > DECLARE
    2 - v_xml CLOB.
    3 v_xml XMLTYPE.
    4 BEGIN
    5 SELECT XMLELEMENT ("Emp") IN v_xml FROM DUAL;
    6 DBMS_OUTPUT. Put_line (v_xml);
    7 END;
    8
    9.

    PL/SQL procedure successfully completed.

  • Stored procedure error

    Hello

    I am Oracle 10 G and is the next version.

    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - production
    PL/SQL Release 10.2.0.4.0 - Production
    CORE 10.2.0.4.0 Production
    AMT for 32-bit Windows: release 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production


    I wrote a small stored procedure, but it is throwing error.

    I'm trying to compile the stored procedure on the side using the advanced search tool.

    Create procedure SCEMANAME.testtest as
    Start
    Insert SCHEMANAME. TEST values (10);
    commit;
    end;

    The error that I do face is the following.

    37000 (900) [oracle] [ODBC] [Ora] ORA-00900: invalid SQL statement

    Any help would be appreciated...

    The problem may lie in your advanced search tool. What happens if you try it in SQL * more?

    BTW, you don't need to specify the schema in the INSERT statement. The procedure is already in this scheme.

  • Compilation of a stored procedure that is frequently consulted

    RDBMS version: 10.2.0.4.0 in a 2 RAC node

    Our Production database is 24 x 7. Our development team has made a change in the code of the procedure frequently consulted.
    At some point this stored proc is accessible by at least 5 sessions.
    I was asked to compile this procedure with the new changes.
    Since this is a frequently viewed, I think that the only option I have left to compile this proc is stopped by the DB and launch it using
    STARTUP RESTRICT
    and then compile it. But, this procedure is actually headed by a DBMS_JOB, so even if I stop, when I restart, the work will resume i.e. that execution of the stored procedure. Right?

    I can't knock local listeners because they are listening to an another DB in the cluster.

    Is there another better way?

    ALTER system set job_queue_processes = 0 will stop the ease of use.

    You might also consider to define windows service and stop the practical execution of cowboy.

    ------------
    Sybrand Bakker
    Senior Oracle DBA

  • Re-compile a package in a stored procedure

    Hi all
    We are using Oracle 10 g. I coded a stored procedure that does a lot of things which is re - create a materialized using the dynamic SQL view. However, when this materialized view is created, a package that this stored procedure must, becomes invalid. What is the syntax to recompile the package using the dynamic SQL? I tried something like script below, but I'm getting ' * ORA-24344: success with compilation error * "error message. I would like to re - build the package until it is used in this stored procedure.

    DECLARE
          v_sql         VARCHAR2 (1000);
          object_name   VARCHAR2 (50) := 'TEST.PS2_FNS366';
    BEGIN
           dbms_output.put_line('This is a test.');
           v_sql := 'Alter package ' || object_name || ' compile  package';
           dbms_output.put_line (v_sql);
           EXECUTE IMMEDIATE v_sql;
         
           v_sql := 'Alter package ' || object_name || ' compile  body';
           dbms_output.put_line (v_sql);
           EXECUTE IMMEDIATE v_sql;      
                  
    END;
    Thank you


    Seyed

    Normally, this means that STUDENT. V_BEN_REG_CASE_NUMBER references objects (tables and views) that has received the STUDENT SELECT on, but not with the WITH GRANT option. If this is the case, STUDENT may not grant other users access to this data.

    If STUDENT. V_BEN_REG_CASE_NUMBER refers to tables A, B and C belonged to another user U, U have to

    GRANT SELECT ON u.a TO student WITH GRANT OPTION;
    GRANT SELECT ON u.b TO student WITH GRANT OPTION;
    GRANT SELECT ON u.c TO student WITH GRANT OPTION;
    

    If the STUDENT has these privileges, it will be able to grant access to his point of view V_BEN_REG_CASE_NUMBER other users.

    Justin

  • Version of 5.0.2.00.07(online à APEX) - error in the execution of a stored procedure through anonymous block

    DECLARE

    the stored procedure varchar2 (25);

    BEGIN

    -DBMS_OUTPUT. Put_line ("enter the name of the procedure :'||: procname");

    the stored procedure: =: procname;

    DBMS_OUTPUT. Put_line (' procedure :'|| stored procedure);

    stored procedure.

    END;

    : procname is a variable binding in the apex to switch the running value.

    apex-bind_var.png

    This is the error I get

    ORA-06550: line 7, column 2:

    PLS-00221: "STORED procedure" is not a procedure or is not defined

    ORA-06550: line 7, column 2:

    PL/SQL: Statement ignored

    5the stored procedure: =: procname;

    6 DBMS_OUTPUT. Put_line (' procedure :'|| stored procedure);

    7. the stored procedure.

    8 END;

    SmtWtL wrote:

    DECLARE

    the stored procedure varchar2 (25);

    BEGIN

    -DBMS_OUTPUT. Put_line ("enter the name of the procedure :'||: procname");

    the stored procedure: =: procname;

    DBMS_OUTPUT. Put_line (' procedure :'|| stored procedure);

    stored procedure.

    END;

    : procname is a variable binding in the apex to switch the running value.

    This is the error I get

    ORA-06550: line 7, column 2:

    PLS-00221: "STORED procedure" is not a procedure or is not defined

    ORA-06550: line 7, column 2:

    PL/SQL: Statement ignored

    5. the stored procedure: =: procname;

    6 DBMS_OUTPUT. Put_line (' procedure :'|| stored procedure);

    7. the stored procedure.

    8 END;

    What you're trying to achieve?

    Bind variables cannot be used for the dynamic execution of stored programs. Dynamic SQL using lexical rather than bind substitution must be used to run when the program name is not known until execution of the programs.

    declare
      sproc varchar2(25);
    begin
      sproc := :procname;
      dbms_output.put_line('procedure:'||sproc);
      execute immediate 'begin ' || sproc || '; end;'; -- DO NOT DO THIS!
    end;
    

    It is a fundamental design flaw and a security disaster. It's stops essential compilation controls is performed and is open to attack by SQL injection and other security vulnerabilities. There is no good reason to do this.

  • Why these stored procedures his does not work

    Hi I'm new and I need help following SQL works correctly, but when I walked into a stored procedure me displays error

    SELECT Por.PortalID,

    Name,

    Lower (LTrim (RTrim (SEOName))) SEOName,

    IsParent,

    Por.Parentid,

    (Select Seoname

    Portal port

    Where Por.Parentid = Port.Portalid) Parentportalname;

    SettingValue.SettingValue DefaultPage

    Por PORTAL

    JOIN SettingValue

    ON Por.PortalID = SettingValue.settingtypeid

    Where Settingtype = 'SiteAdmin '.

    And Settingkey = 'PortalDefaultPage. '

    his return:

    Portald Name SEONAME ISPARENT ParentId parentportalname DefaultPage
    1by defaultby default10nullHomepage

    It's my stored procedure

    create or replace

    Procedure Sp_Portalgetlist as

    Start

    SELECT Por.PortalID,

    Name,

    Lower (LTrim (RTrim (SEOName))) SEOName,

    IsParent,

    Por.Parentid,

    (Select Seoname

    Portal port

    Where Por.Parentid = Port.Portalid) Parentportalname;

    SettingValue.SettingValue DefaultPage

    Por PORTAL

    JOIN SettingValue

    ON Por.PortalID = SettingValue.settingtypeid

    Where Settingtype = 'SiteAdmin '.

    And Settingkey = 'PortalDefaultPage ';

    END SP_PORTALGETLIST;

    When I compile with oracle sqldeveloper show this error:

    • Error (4.1): PLS-00428: an INTO clause in this SELECT statement

    I appreciate all the help

    What about the compile error in a PL/SQL block a select statement has an additional part:

    Select attr1, attr2...

    in var1, var2,...

    Of...

    but you can also use your selection (without the) in a cursor:

    procedure is...

    cursor my_select is

    Select...;

    my_variable my_cursor % rowtype;

    Start

    Open my_cursor;

    extract my_cursor in my_variable; -fails at the record and then one more found!

    close my_cursor;

    ...

    Good bye

    DPT

  • Error of insufficient privileges on the creation of model running in a stored procedure

    Hello

    I get the error of insufficient privileges on execution of the DBMS_DATA_MINING. Script CREATE_MODEL in a stored procedure.

    If I run the same DBMS_DATA_MINING. Script CREATE_MODEL in an anonymous block with just begin... end;

    I am able to create a model successfully, but if I do the same thing after having stored the script in the stored procedure, it is throwing error of insufficient privileges.

    Scripts:

    BEGIN

    DBMS_DATA_MINING. () CREATE_MODEL

    Model_name = > < template name >

    mining_function = > dbms_data_mining. CLASSIFICATION,

    DATA_TABLE_NAME = > < data table name >

    CASE_ID_COLUMN_NAME = > < case ID >

    target_column_name = > < target column >

    SETTINGS_TABLE_NAME = > < settings table >

    DATA_SCHEMA_NAME = > < schema >

    SETTINGS_SCHEMA_NAME = > < schema >

    );

    END;

    The foregoing, works very well and created a model with the model given with success.

    But if I keep the above, in a stored procedure as - MINING_TESTING

    create or replace procedure MINING_TESTING as

    BEGIN

    DBMS_DATA_MINING. () CREATE_MODEL

    Model_name = > < template name >

    mining_function = > dbms_data_mining. CLASSIFICATION,

    DATA_TABLE_NAME = > < data table name >

    CASE_ID_COLUMN_NAME = > < case ID >

    target_column_name = > < target column >

    SETTINGS_TABLE_NAME = > < settings table >

    DATA_SCHEMA_NAME = > < schema >

    SETTINGS_SCHEMA_NAME = > < schema >

    );

    END;

    Compiles correctly.

    Enforcement - EXEC MINING_TESTING;

    Error message throw sufficient privileges.

    The error message complete below:

    Error report:

    ORA-01031: insufficient privileges

    ORA-06512: at "SYS." DBMS_DATA_MINING', line 1798

    ORA-06512: at "MIS_ORABI_ODM.CA_MINING_TESTER", line 3

    ORA-06512: at line 1

    01031 00000 - "insufficient privileges".

    * Cause: An attempt was made to change the user name or password

    without the privilege appropriate. This error also occurs if

    trying to install a database without the need for employment

    access privileges.

    When Trusted Oracle is configure in DBMS MAC, this error may occur

    If the user has been granted the privilege necessary for a higher label

    that the connection is active.

    * Action: Ask the database to perform the operation or grant administrator

    the required privileges.

    For users Trusted Oracle get this error, well that granted the

    the privilege that is suitable for the top label, ask the database

    administrator to grant the privilege to the appropriate label.

    Hello

    DataMiner UI grants privileges to a role, so if you're depending on these privileges you must proceed as follows when you create a stored procedure.

    Your stored procedure was created with the default authid which is definers. It will not use the privileges for the role. Solution is to create the stored procedure with authid current_user. This will pick up the privileges for the role. Another option is to apply the following subsidies directly to the user account:

    grant CREATE MINING MODEL

    CREATE THE TABLE,

    IN ORDER TO CREATE

    Example of stored procedure:

    create or replace procedure MINING_TESTING AUTHID CURRENT_USER as

    BEGIN

    DBMS_DATA_MINING. () CREATE_MODEL

    MODEL_NAME =>

    mining_function-online dbms_data_mining. CLASSIFICATION,

    DATA_TABLE_NAME =>

    CASE_ID_COLUMN_NAME =>

    target_column_name =>

    SETTINGS_TABLE_NAME =>

    DATA_SCHEMA_NAME =>

    SETTINGS_SCHEMA_NAME =>

    );

    END;

    Thank you, Mark

  • How to do a select on the results of a stored procedure?

    Hello

    I am new to Oracle. I work with SQL Developer.

    I'm doing a simple select on the results of a stored procedure call. I don't know how to do it. Here's what I have so far:

    declare
    type ref_cursor is ref cursor;
    results ref_cursor;
    Start
    MyStoredProcedure (123 results);
    Select * from results;
    end;
    /

    but he said to me:

    Error from the 1 in the command line:
    declare
    type ref_cursor is ref cursor;
    results ref_cursor;
    Start
    GET_TAX_TYPE_BY_TAX_ENTITY_KEY (60670100000000, results);
    Select * from results;
    end;
    Error report:
    ORA-06550: line 6, column 15:
    PL/SQL: ORA-00942: table or view does not exist
    ORA-06550: line 6, column 1:
    PL/SQL: SQL statement ignored
    06550 00000 - "line %s, column % s:\n%s".
    * Cause: Usually a PL/SQL compilation error.
    * Action:

    Obviously, select * results; is not the right way to do it. But what is?

    Thanks for any advice forthcoming.

    If a SQL cursor is built by a reporting system, a Java application, a c# program, or a PL/SQL call - the database doesn't care, because he doesn't know the difference. A Select SQL cursor created in PL/SQL through the ref cursor interface, won't be faster than the same SQL select in Eclipse. If the SQL source code is the same, the same cursor SQL program will be used by both.

    What give you BIRT is the flexibility of the use of code Server (PL/SQL) to create the slider - this code doing business and technical decisions on how to design side than SQL, Select. Which is a good thing because it summarized the data model and the complexity BIRT server technique.

    So my choice would be to use the procedural interface and return to the reporting system for the rendering of the ref Cursor.

    The question of a slider running via the slider (selection of a cursor), is questionable. Yes, there are a set of specifications that allows to do this kind of thing. But it must be very firmly justified and careful design because it really is an exception. I personally (blame my DBA) would need a justification because it is much more of an exception. I have never seen it put in place in production in more than a decade of DBA'ing, despite the developers try to use such a hack - as it has always been much more powerful and the deployment of alternatives.

    The concept for robust and efficient code for Oracle is: Maximise SQL. Minimize the PL/SQL (or Java / c# / etc.).

    That means when it comes to database power, write an SQL program to do. Stop thinking of SQL as a language of data recovery a single simplistic statement. Think of it as a programming language. Extremely complex problems can be resolved with a single SQL, which requires easy code 100 + lines of PL/SQL, Java, or c#. Write SQL programs. Not SQL one-liners for a grinding program PL/SQL or Java data.

    Why then PL/SQL? It is the best language to manage the creation of SQL, dealing with the process flow, conditional processing, and so on of exception handling. It is less than SQL (such as Java and c#) in the treatment of the data.

  • Double games of results returned on stored procedure call

    Hello

    I have a stored procedure created Java and called using the Spring JDBC using StoredProcedure class, stored procedure returns duplicate rows, is this a known problem?

    When I run the stored procedure even in DBVizualiser it not show correctly.

    The class below is used to execute the stored procedure:

    public class CustomerSearchProcedureRunner extends StoredProcedure {
     public CustomerSearchProcedureRunner(JdbcTemplate jdbcTemplate) {
      super();
      this.setJdbcTemplate(jdbcTemplate);
      this.declareParameter(new SqlReturnResultSet(RETURN_RESULTS, new CustomerRowMapper()));
      this.declareParameter(new SqlParameter(CUST_SP_IN_PARAM, Types.VARCHAR));
      this.setSql("{CALL INSURANCE.SEARCHCUSTOMER (?) ON ALL}");
      this.setSqlReadyForUse(true);
      this.compile();
     }
    }
    


    and Java Stored Procedure that runs SQLFire is given below:

    public class CustomerSearchProcedure {
     
     private static final String DOLLAR = "\\$";
     private static final String COLON = ":";
     private static final String CUST_NAME = "CUST_NAME";
     private static final String CUST_NO = "CUST_NO";
     private static final String GENDER = "GENDER";
     
     
     public static void searchCustomer (String customers, ResultSet[] outResults,
       ProcedureExecutionContext context) throws SQLException {
      StringBuilder sql = new StringBuilder();
      StringBuilder whereCondt = new StringBuilder();
      String[] tokens = new String[]{};
      
      if (customers != null && customers.trim().length() > 0) {
       tokens = customers.split(DOLLAR);
      }
      
      sql.append("<global>SELECT * FROM INSURANCE.CUSTOMERS ");
      whereCondt.append("WHERE CUST_PRIMARY IN ('Y', 'N') ");
      // Apply dynamic where condt
      for (int i=0; i < tokens.length; i++ ) {
       String token = tokens[i];
       if (token.startsWith(CUST_NO)) {
        if (whereCondt.length() > 0) {
         whereCondt.append(" AND ");
        }
        whereCondt.append("CUST_NO = " + token.substring(token.indexOf(COLON)+1));
       }
       if (token.startsWith(CUST_NAME))  {
        if (whereCondt.length() > 0) {
         whereCondt.append(" AND ");
        }
        whereCondt.append("CUST_NAME LIKE '"+ token.substring(token.indexOf(COLON)+1).trim() + "%'");
       }
       if (token.startsWith(GENDER)) {
        if (whereCondt.length() > 0) {
         whereCondt.append(" AND ");
        }
        whereCondt.append("GENDER ='"+ token.substring(token.indexOf(COLON)+1).trim() + "'");
       }
      } //End of for
      
      if (whereCondt.length() > 0) {
       sql.append(whereCondt.toString());
      }
      
      Connection cxn = context.getConnection();
      Statement stmt = cxn.createStatement();
      ResultSet rs = stmt.executeQuery(sql.toString());
      outResults[0] = rs;
     } //END OF METHOD
    }
    

    A correction preceding: "for the case on the information in the TABLE of the DataSet to be targeted on each node is also sent for the tag requests will target only this dataset (and avoids duplicates).»

    should read "in the case of on TABLE query Tags will only target the local primary data on the node for tables partitioned, while for replicated tables, it is sent to only one of the lines (and so avoids duplicates in both cases).» WHERE clause to TABLE is not used for cutting data only for the size of the set of nodes to the target.

    The tag prunes yet the query to all of the local primary buckets in all cases (i.e. which WE ALL and on GROUPS of SERVERS) so the comment about and equivalent was incorrect. However, this will always be looking for data in duplicate for replicated tables and TABLE is the only way to avoid it for now.

  • Privileges differ between SQL * more and stored procedure

    A user with the dba role can access dba_role_privs. But this is not possible in a stored procedure created by the same user.
    Normally, the example should work fine
    But with Oracle XE 11.02 - cost free database with some limitations - I get error 942

    I show a simple example in SQL * more:

    SQL > r
    1 * select distinct dba_role_privs recipient where the recipient as "SY %.

    DEALER
    ------------------------------
    SYSTEM
    SYS

    SQL > create or replace procedure x as
    2 start
    3 for rec in (select distinct dba_role_privs dealer where the beneficiary as 'SY %')
    4 loop
    5 zero;
    6 end of loop;
    7 end;
    8.

    Warnung: Prozedur wurde mit Kompilierungsfehlern standing.
    English translation: procedure created with compilation errors

    SQL > show error

    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    3/14 PL/SQL: statement ignored
    3/43 PL/SQL: ORA-00942: table or view does not exist
    SQL >

    How can I fix?

    Why do you think the example should work properly?

    Normally, regardless of the version, the privileges granted through roles (such as DBA) not available for stored procedures. Stored procedure of a DEFINER rights can only take advantage of the privileges granted directly to the owner of the procedure. Stored procedure of the invoker rights can enjoy privileges granted by a role, but that requires that the appellant has independent privileges to query the table in question (and, in this case, would require dynamic SQL usage).

    Generally, the simplest approach would be to grant the privilege to CHOOSE ANY DICTIONARY to the owner of the procedure.

    Justin

  • insufficient privileges when executing stored procedure

    Hello gurus,
    I'm new to plsql, working on a stored procedure.
    Basically, trying to create a temporary table by using the dynamic sql... Here is my code, the runtime, I'm encoutering error of insufficient privileges. not sure where I'm wrong. any help is appreciated, thanks

    -successfully - compiled code
    SQL > CREATE or REPLACE procedure stp_temp (i_table in varchar2)
    2 is
    3 table_creation_stmt varchar2 (4000): = ";
    4 start
    5
    6 table_creation_stmt: = 'CREATE of TABLE TEMPORARY GLOBAL' | i_table | ' AS select * from TABLE_STGG';
    7 dbms_output.put_line (' query is :'|| table_creation_stmt);
    8 execution immediate table_creation_stmt;
    9 end;
    10.

    Created procedure.

    SQL > exec stp_temp ('table123');
    Request: CREATE TEMPORARY TABLE global table123 AS select * from TABLE_STGG
    BEGIN stp_temp ('table123'); END;

    *
    ERROR on line 1:
    ORA-01031: insufficient privileges
    ORA-06512: at "E3US9T. STP_TEMP', line 8
    ORA-06512: at line 1


    -table gets created to copy/paste on top of the output (that is the query)

    SQL > CREATE GLOBAL TEMPORARY TABLE table123 AS select * from TABLE_STGG;

    Table created.

    Why the hell you create a TWG in a stored procedure?

    Create once and be done with it.

    To answer your question, your create table privilege granted to you via a role. Roles are not in pl/sql, you need the privilege granted to you directly.

  • Delete records from sys.aud$ stored procedure

    We have a stored procedure that attempts to move the records from the table of sys.aud$ to a history table (in order to keep sys.aud$ to a more reasonable size, I guess - full disclosure, I have not written this proc). Base flow is:
    Select count (*) in the number of lines of sys.aud$
    If {(rowcount > 1000)
    copy all rows in sys.aud$ in the history table
    remove from sys.aud$
    }

    I says this proc used to work perfectly in a troubled past (I'm new on the client) but now has not worked for a while. When we try to compile the proc, we get the error
    "table or view does not exist", and the line is the "deletion of sys.aud$. The line "select count (*) from sys.aud$ ' seems to cause no problems, but the proc does not compile as is. If I comment out the line "remove from sys.aud$", however, the proc compiles very well.

    Confusingly, if I log in as the same account that owns this proc, I can run both the count (*) select from sys.aud$ AND remove clauses sys.aud$ with no complaint at all (by modifying slightly to work with 1 single record at a time, of course), but I can't seem the same to compile in a stored proc.

    I guess that it is related permissions? Can someone point me to the permissions of the owner needs to be able to remove from sys.aud$ in a stored procedure? Or is there something else that needs to be done here? Pointers much appreciated.

    Thank you.

    956928 wrote:
    We have a stored procedure that attempts to move the records from the table of sys.aud$ to a history table (in order to keep sys.aud$ to a more reasonable size, I guess - full disclosure, I have not written this proc). Base flow is:
    Select count (*) in the number of lines of sys.aud$
    If (rowcount 1000 >) {}
    copy all rows in sys.aud$ in the history table
    remove from sys.aud$
    }

    I says this proc used to work perfectly in a troubled past (I'm new on the client) but now has not worked for a while. When we try to compile the proc, we get the error
    "table or view does not exist", and the line is the "deletion of sys.aud$. The line "select count (*) from sys.aud$ ' seems to cause no problems, but the proc does not compile as is. If I comment out the line "remove from sys.aud$", however, the proc compiles very well.

    Confusingly, if I log in as the same account that owns this proc, I can run both the count (*) select from sys.aud$ AND remove clauses sys.aud$ with no complaint at all (by modifying slightly to work with 1 single record at a time, of course), but I can't seem the same to compile in a stored proc.

    I guess that it is related permissions? Can someone point me to the permissions of the owner needs to be able to remove from sys.aud$ in a stored procedure? Or is there something else that needs to be done here? Pointers much appreciated.

    Thank you.

    acquired through ROLE privileges are NOT applicable within the named PL/SQL procedures.

    GRANT DELETE ON SYS. AUD$ ;

  • Command SQLPLUS to execute stored procedure

    Hello

    I'm trying to run the command SQLPLUS (CONNECT) to the stored procedure.

    It is throwing the error message below.


    Stored procedure:

    SQL > select use double
    2;

    USER
    ------------------------------
    SYS

    SQL > create or replace
    2 PROCEDURE PROCEDURE1 AS
    3 BEGIN
    4 sqlplus sys/sys@D as sysdba;
    5 - immediate execution "create user 'kkk' identified by 'kkk';
    6 END PROCEDURE1;
    5 m

    CAUTION: Procedure created with compilation errors.

    SQL > show err
    PROCEDURE1 PROCEDURAL errors:

    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    3/9 PLS-00103: encountered the symbol "SYS" when awaits an of the
    Next:
    := . ( @ % ;
    The symbol ': = ' was replaced by 'SYS' continue.

    3/22 PLS-00103: encountered the symbol "UNDER" when awaits an of the
    Next:
    . (* @ & = - +; <>/ at mod is still not rem)
    < an exponent (*) > <>or! = or ~ = > = < = <>and or LIKE2_
    LIKE4_ LIKEC_ between | Member SUBMULTISET_
    The symbol "." has been inserted before "AS" to continue.


    Please let me know if it is possible to do or not.
    If it is possible how is this possible?

    Published by: NGK246 on August 28, 2012 02:21

    NGK246 wrote:
    Now I tried to implement even taking arguments when running in the command prompt, but the OraCallTest.log file is not created.
    Please let me know why is it happening as such.

    Please show it does not work. It works well for me...

    c:\Temp>notepad testing.bat
    
    c:\Temp>more testing.bat
    @echo off
    SET DBUser=%1
    SET DBPass=%2
    SET DBTNS=TEST
    SET LOG=C:\temp\
    
    ECHO spool OraCallTest.log > %LOG%OraCallT.sql
    ECHO set linesize 132 >> %LOG%OraCallT.sql
    ECHO select * from dual; >>%LOG%OraCallT.sql
    ECHO spool off >> %LOG%OraCallT.sql
    ECHO exit >> %LOG%OraCallT.sql
    sqlplus -s "%DBUser%/%DBPass%@%DBTNS%" @%LOG%OraCallT.sql > %LOG%PLTT.log
    
    c:\Temp>testing scott tiger
    
    c:\Temp>more pltt.log
    
    Session altered.
    
    D
    -
    X
    
    c:\Temp>more oracallt.sql
    spool OraCallTest.log
    set linesize 132
    select * from dual;
    spool off
    exit
    
    c:\Temp>more oracalltest.log
    
    D
    -
    X
    

Maybe you are looking for

  • Satellite P300D - problems with WLAN using security 'WPA '.

    Hello everyone. I need your help. My new laptop Satellite P300D makes me angry. I want to use the WLAN using "WPA" security on my router, but this seems to be a problem. The notbook is able to find the WIFI network, but there is no possible connectio

  • 6733 OR general issues

    Hi all I'm having some trouble with the NI PCI-6733 device and I have a few questions about this. 1. What is the resistance of exit? 2. can I change the output resistance? 3. If I change the output resistance, can be infinite? Thank you

  • Is there a version of Windows 7, Windows Media Player 10 or higher?

    I am running Windows 7 Professional on my computer and when you try to link an external DVD drive to the computer, I get a message that Windows Media Player 10 or higher is required. What can I do to use exrternal on my computer Windows 7 proffession

  • Internet access WRT54GS - No.

    Hey, Ive had problems with internet connection for these days and ive been what I do usually just unplug the router and the modem and turn their back on but that did not work this time, its connection again but it just says not: no internet access, b

  • User registration application

    Hi allWhat is the best way to set up a registration of the user without customization page is committed?I know that to engage, you can use attributes to visitor and save users in Tables to engage, but without committing? Can I use the same tables to