How to execute procedure in SQL Worksheet ?

Hi, anybody know, how I can execute procedure here?
I try EXEC sec_roles, EXEC security_admin.sec_roles, EXECUTE - there is a SQL statement error. When I use CALL - there is no such procedure (I have execute previleges).
Although in SQLPlus EXEC works, but there are problems with standard SQL commands (all of them returns "2" no matter what content is).
Any ideas?
Regards
Krzysztof

exec procedure(parameters) is a sql plus (and a few others) shortcut for
BEGIN
   procedure(parameters);
END;So try that then pressing/clicking whatever it is in sql worksheet that makes a statement run.
Note that if your procedure has parameters defined as OUT or IN OUT, you will need to supply a variable to accept the returned value(s).
John

Similar Messages

  • How to execute procedure in toad software

    hiii guy's i run my procedure on sql prompt and it run properly
    but when i tried this on toad i got an problem
    after compiling my procedure on toad
    when i write
    execute procedure_name(parameter1,parameter2);
    then i get an error i.e
    ORA-00900: invalid SQL statement
    can someone tell me how to execute procedure on toad
    thanks in adv...........

    how to execute procedure in toad softwareIn TOAD's schema browser you can go to the procedures tab - right click on the procedure in question and choose execute procedure - a window should pop up, where you can give optional parameters - the rest should be almost self explanatory ;)

  • How to execute a PL/SQL in JAVA

    I know how to execute a store procedure in PL/SQ. But how to execute a PL/SQL in JSP or other JAVA application?
    Thank you!

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Chin Chia Liang ([email protected]):
    I know how to execute a store procedure in PL/SQ. But how to execute a PL/SQL in JSP or other JAVA application?
    Thank you!<HR></BLOCKQUOTE>
    You should use CallableStatement.
    import java.sql.*;
    class StoreProc
    public static void main (String args [])
    throws SQLException {
    try {
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection conn =DriverManager.getConnection ("jdbc:oracle:thin:@testing:1521:test1", "scott", "tiger");
    //create procedure and call it in java (testproc)
    CallableStatement cstmt = conn.prepareCall("{call testproc(?,?)}");
    cstmt.setString(1, "teststore");
    (2, "testagain");
    cstmt.executeUpdate();
    cstmt .close();
    conn.close();
    catch(SQLException e)
    System.out.println("SQLException caught: " + e.getMessage()+" "+e.getErrorCode());
    null

  • How to execute a script(.sql) file from a PL\SQL procedure

    I would like to know how to execute a .sql file from a stored procedure and the result of it should update a table. My .sql file contains select statements.

    Hi!
    just go through the following piece of code -
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    str varchar2(200);
      3  begin
      4    str := '@C:\RND\Oracle\Misc\b.sql';
      5    execute immediate(str);
      6* end;
    SQL> /
    declare
    ERROR at line 1:
    ORA-00900: invalid SQL statement
    ORA-06512: at line 5ORA-00900: invalid SQL statement
    Cause: The statement is not recognized as a valid SQL statement. This error can occur if the Procedural Option is not installed and a SQL statement is issued that requires this option (for example, a CREATE PROCEDURE statement). You can determine if the Procedural Option is installed by starting SQL*Plus. If the PL/SQL banner is not displayed, then the option is not installed.
    Action: Correct the syntax or install the Procedural Option.
    Regards.
    Satyaki De.

  • How to execute procedure

    Hi,
    I have a procedure which is returning the cursor. Like this:
    Create Procedure rptschool
    cur_out OUT SYS_REFCURSOR
    IS
    BEGIN
    OPEN cur_out FOR
    SELECT      *
    FROM xxx
    END;
    Now I need to execute the above procedure from SQLPLUS. So I am calling like this:
    Begin
    Exec rptschool
    End;
    It is giving error. How to execute the procedure from SQLPLUS tool or PLSQL Developer tool.
    Thanks in advance

    this?
    SQL> ed
    Wrote file afiedt.buf
      1  Create or replace Procedure rptschool(cur_out OUT SYS_REFCURSOR)
      2  IS
      3  BEGIN
      4    OPEN cur_out FOR
      5    SELECT *
      6    FROM emp
      7    where deptno=10;
      8* END;
    SQL> /
    Procedure created.
    SQL> var cout refcursor;
    SQL> execute rptschool(:cout);
    PL/SQL procedure successfully completed.
    SQL> print :cout;
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
          7839 KING       PRESIDENT            17-NOV-81       5000                    10
          7934 MILLER     CLERK           7782 23-JAN-82       1300                    10

  • Executing Procedure in SQL SERVER and Storing the results in Oracle 10g

    Hello,
    I am trying execute SQL SERVER procedure from Oracle 10g and store the results in a oracle table. When I tried executing the procedure i am getting errors.
    I am using Oracle Heteroeneous Services.
    Steps I followed.
    1. Created ODBC DSN on Oracle Server connecting to SQL SERVER database.
    2. Created Listner entry and TNSNAMES entries.
    3. Created Database link and able to select the data from the SQL SERVER tables.
    Here is the code i tried to execute the procedure.
    BEGIN
    "META"."extract"@abc;
    END;
    "META"."extract"@abc;
    ERROR at line 2:
    ORA-06550: line 2, column 1:
    PLS-00201: identifier 'META.extract@ABC' must be declared
    ORA-06550: line 2, column 1:
    PL/SQL: Statement ignored
    Please help me.
    Thank You,
    Seshadri Thope

    Hi thopevs,
    Can you please tell me the right syntax of calling procedures(on sql server) from oracle?
    I am getting following error:
    SQL> execute "GetdateSys"@oratosql;
    begin "GetdateSys"@oratosql; end;
    ORA-06550: line 2, column 7:
    PLS-00201: identifier 'GetdateSys@ORATOSQL' must be declared
    ORA-06550: line 2, column 7:
    PL/SQL: Statement ignored
    SQL>
    Your help will be highly appreciated.
    Thanks & Regards,
    M.U.N.A

  • How to copy procedure to sql plus window.

    I am trying to copy my procedure from note pad to sql plus window and some of the texts are being cut off. How can I copy the entire procedure to sql plus window.
    thanks

    Thank you guys this is what is happning.
    1  CREATE OR REPLACE PROCEDURE  ITEMCUSTOMPAGING(
    2        p_desc in itemlist.idescr%type,
    3        p_letting in bidlet.datelet%type,
    4        p_letting1 in bidlet.datelet%type,  
    5       p_sort in  NUMBER ,
    6       p_order in VARCHAR ,
    7        i_results    out sys_refcursor
    8     )
    9     AS
    10     BEGIN
    11        OPEN  i_results  FOR
    12         SELECT g.csecnum , e.iplineno , substr(e.eiitem ,1,4)||'.'||substr(e.eiitem ,5,9) ItemNum,
    13         INITCAP(i.idescr ||'  '|| e.isupdes)  Descrip,INITCAP(i.idescrl ||'  '|| e.isupdes)  Descrip
    14         DECODE (TRIM (p.prroute), NULL, 'N/A',p.prroute) Route,b.datelet  ,trim(to_char(b.datelet ,'
    15        FROM itemlist i, estitem e, estcatg g, propproj x, proposal p, bidlet b, letprop l
    16        WHERE    p.contid = x.contid AND x.pcn = g.pcn AND e.pcn = g.pcn AND e.cn = g.cn AND i.item =
    17        AND i.ispecyr = p.cspecyr AND e.iplineno <> ' ' AND e.eiitem <> '2550601/01000'
    18        AND e.eiitem <> '2565601/00031' AND e.eiitem <> '2565601/00032' AND e.eiitem <> '2565601/0003
    19        AND e.eiitem <> '2402601/01000'
    20        AND (i.idescr  like  TRIM(UPPER(p_desc))||'%'  or  i.idescrl  like  TRIM( UPPER(p_desc))||'%'
    21        AND b.datelet  between  p_letting  and p_letting1
    22        AND p.contid = l.lcontid
    23        AND l.letting = b.letting
    24        AND SUBSTR (l.lcontid, 4, 4) <= '5'
    25        GROUP BY g.csecnum,i.idescr,b.datelet,i.iunits,p.clocat1,p.clocat2,p.contid,p.cdescr, p.cproj
    26        ORDER BY p_sort   p_order;
    27* End;
    QL> /
    arning: Procedure created with compilation errors.
    QL> SHOW ERR
    rrors for PROCEDURE ITEMCUSTOMPAGING:
    INE/COL ERROR
    2/8     PL/SQL: SQL Statement ignored
    6/25    PL/SQL: ORA-00933: SQL command not properly ended
    QL>

  • Return code for EXECUTE PROCEDURE (native SQL)

    Hi Experts,
    I've seen in the Note 364707 that the field %_ERRCODE is no longer supported since WAS 6.10 for stored procedures like this:
    EXEC SQL.
      EXECUTE PROCEDURE proc [(parameter list)] %_ERRCODE INTO :rc
    ENDEXEC.
    So an Upgrade to WAS 7.00 gives this programms an error.
    Has anybody an idea for an alternative?
    Regards,
    Stefan

    Hello Peluka,
    i have seen you have worked with 'execute procedure'.
    I want to execute a procedure with two Parameters and one structure. Example:
    EXECUTE PROCEDURE test.p_getdata ( in :i_ls_nr , in :vdatum , out :vtest ).
    vtest has the simple structure with field lieferscheinnr (char25).
    When i execute the procedure, i get the error <b>wrong number or types of arguments in call</b>.
    Do you know, whether execute procedure with structures is not possible?
    Thank you in advance.

  • Extension API 1.5.1: How can i open a SQL Worksheet ?

    Hi,
    i try to build a simple Table API generator. Everything is finish. The only thing i need is open the generated sql script inside a SQL Worksheet for preview. I try following code:
    RaptorDBAddin.getSqlOpener().openNewEditor("select sysdate from dual;", getDBObject().getConnectionName());
    But i get following compile error:
    Error(32,9): class oracle.ide.db.model.SqlNode not found  in class de.team.sqldev.generator.GenerateAction
    My extension.xml looks like:
    <extension id="team.sqldevgenerator" version="1.0" esdk-version="1.0"
    rsbundle-class="team.sqldevgenerator.Res"
    xmlns="http://jcp.org/jsr/198/extension-manifest">
    <name>team.sqldeveloper.generator</name>
    <dependencies>
    *<import>oracle.ide</import>*
    *<import>oracle.sqldeveloper</import>*
    *<import>oracle.javacore</import>*
    </dependencies>
    <hooks>
    <feature-hook>
    <description>This Extension provide generation of database objects based on table definition such like sequence, trigger, table-api-package</description>
    </feature-hook>
    <jdeveloper-hook xmlns="http://xmlns.oracle.com/jdeveloper/1013/extension">
    <addins>
    <addin>de.team.sqldev.generator.GeneratorAddin</addin>
    </addins>
    </jdeveloper-hook>
    <sqldev-navigator-hook xmlns="http://xmlns.oracle.com/sqldeveloper/sqldev-navigator">
    <descriptor>/de/team/sqldev/generator/table.xml</descriptor>
    </sqldev-navigator-hook>
    </hooks>
    </extension>

    If the WMVs don't contain DRM, use a product such as VLC.
    If the WMVs do contain DRM, no Mac OS X software will open or convert them.
    (120714)

  • How to execute procedure returning data rows from sql plus

    Hi,
    I want to execute a stored procedure that returns data rows from sql plus. please let me know the syntax for the same.
    Thanks,
    YG

    user13065317 wrote:
    Even if i get the result set into the cursor, do i have to do normal fetch into all the coumn variables within a loop
    But suppose no of columns in my result set varies depending on a parameter to the stored procedure.
    Is there any straightforward way to retrieve all the data irrespective of no of columns in the result set.There is no such thing as a "+result set+". Oracle does not create a temporary data set in memory that contains the results of your query. What would happen if this result set is a million rows and is too large to fit into memory? Or there are a 100 clients each with a 100,000 row result set?
    This is not scalable. You will be severely limited in the number and sizes of these "+result sets+" that can be created in server memory.
    A cursor is in fact a "program" that is created by compiling the SQL source code that you provide. This source code is parsed and compiled into what Oracle calls an execution plan. This is nothing but a series of instructions that the cursor will execute in order to return the rows required.
    Thus the result set is actually the output from a cursor (a program). Likewise, bind variables are the input parameters to this program.
    All SQLs are parsed and compiled as cursors and stored in the SQL Shared Pool. Oracle gives you handle in return to use to address this cursor - bind values to it, execute it, describe the output structure returned by the cursor, and fetch the output from the cursor.
    On the client side, this handle is used in different ways. In PL/SQL alone, this cursor handle can be used as an implicit cursor (you do not even see or use the cursor handle in your PL/SQL code). Or you can use a PL/SQL cursor variable. Or a DBMS_SQL cursor variable. Or a reference cursor variable.
    Why so many different client structures for the very same SQL cursor handle returned by Oracle? Because to allow you, the programmer, all kinds of different features and flexibility.
    The ref cursor feature is the ability to pass this cursor handle around, not only between PL/SQL code, but also from PL/SQL to the actual client process (Java. VB, SQL*Plus, TOAD, etc).
    The primary thing to remember - irrespective of what the client calls this (e.g. ref cursor, SQL statement handle, etc), this all refers to the same SQL cursor in the Shared Pool. And that this SQL cursor is a program that outputs data, and not a result set in itself.

  • Executing Procedures in sql Developer

    Hi ,
    I'm new to SQL Developer and trying to explore the tool . I have written a procedure as
    create or replace PROCEDURE SAMPLE2 AS
    studName Varchar2(8) ;
    BEGIN
    SELECT Stud1.NAME INTO studName
    FROM Stud1
    WHERE Stud1.NAME = 'SOM';
    END ;
    It has compiled perfectly .
    Now when I run by right clicking it works
    But when I'm running it using
    BEGIN
    exec SAMPLE2()
    END;
    or
    BEGIN
    SAMPLE2()
    END;
    it is giving error .
    Morover can you tell me how I can view the data after running the procedure .

    See Executing Anonymous Blocks in SQL Developer
    Remember statements always need to end with ;
    Regards,
    K.

  • How to execute procedure with dynamic where condition.

    Hi All,
    I am facing a probelem
    Issue :
    I am having a parameter p_id in my procedure based on the value of this parameter i want to change the where condition.
    How to do so?
    Code:---------
    create or replace procedure p_1
    ( p_id in emp_dummy.empno%type)
    is
    parameter_1 varchar2(2000);
    v_sal number;
    begin
    if p_id = 1 then
    parameter_1 := 'where empno = 1';
    else
    parameter_1 := 'where 1=1';
    end if;
    select salary into v_sal from emp_dummy||' '||parameter_1;
    end;

    Dynamic SQL is not the best of ideas, but if you must...
    EXECUTE IMMEDIATE 'select salary from emp_dummy where empno=nvl(:x,empno)' into v_sal using p_id;Then if you pass in the p_id to the procedure it will select the salary for that employee and if null is passed in then it will select the salary for all employees. Now here's a problem because you are trying to return a single value and if you don't specify the employee then it will try and return multiple values from that select, so you probably want to do something like give the sum of the salaries...
    EXECUTE IMMEDIATE 'select sum(salary) from emp_dummy where empno=nvl(:x,empno)' into v_sal using p_id;

  • How to run procedure in sql navigator?

    Hi,
    Can anyone tell me how can i run stored procedures in a package from SQL NAVIGATOR?
    Thank you

    If there are no OUT-Parameters just
    exec <package_name>.<procedure_name>
    as it´s done in SQL*Plus.
    Regards,
    Gerd

  • How to run procedure from SQL Commands

    I have tried several ways, for example:
    EXECUTE POPULATE_HIERARCHY(121121);
    but I get the error: ORA-00900: invalid SQL statement.

    BEGIN
      POPULATE_HIERARCHY(121121);
    END;

  • How to execute procedure without having extra connection

    I am asking this question again, i want to execute the oracle database procedure from within the JDeveloper without getting any extra connection like JDBC connection. I tried this using dbaccess.executeretrieval()and executecommand() method, but not finding any solution. My procedure has two input parameters and four output parameters.
    can anybody help on this??
    vikas
    null

    this can be done using the CallableStatement class.
    typecast the reference of the application module that you have to applicationmoduleimpl. ApplicationModuleImpl class has a method PrepareCallableStatement that returns an object of type CallableStatement. the prepare method takes 2 parameters. one is the statement to execute and one is the number of expected return rows. inorder to call an SP, the statement should be call <name od sp in caps>.
    to execute the statement, the callable statement class provides the execute() method. it has methods for specifying the IN OUT parameters also (go through jdeveloper help for details).

Maybe you are looking for

  • If I use pages and numbers on a Mac can I save the documents as an extension that I can use on a PC?

    If I use pages and numbers on a Mac mini can I then save the documents as  extensions that can be opened on a PC?

  • JDBC Driver to Support nvarchar/nchar/ntext

    I downloaded the jdbcKona driver for MS SQL Server 7/2000 from the "Download Center". This page claims that this driver supports the international data types (nvarchar, nchar, and ntext) on SQL Server 7/2000. http://www.weblogic.com/docs51/techstart/

  • Urgent Please help: ORA-00940: invalid ALTER command

    I am not able to start my oracle db that is running Solaris 10, Oracle 10g. I made the following changes to Oracle Parameter and now I am not able to start. alter system set "_fix_control"='5705630:ON' scope=spfile; I get this error: ORA-00940: inval

  • Error message on Merge to HDR

    Hi - Whenever I use the Merge to HDR function (CS4, using XP, SP3) I get a strange error message at the end of the processing portion (just before the completed 32-bit image displays).  The error says something to the effect that it's possible that t

  • Getting to the OK prompt on a V250

    History of the machine is unknown, someone prior to me installed solaris 9. I do not know any user/pass combos, and have tried several obvious root password. The server uses a USB SUN keyboard mouse combo. The keyboard does not recieve power (i.e. nu