Executing a proc in PL/SQL Developer

Hi All,
I have created a proc and compiled it sucessfullly . When im writing DECLARE in the proc and running , its doing the exact operation whereas when i right click the proc and do Test and pass the parameters , its not doing the required action.
Can anyone please help

Bawer wrote:
if you write DECLARE in a proc, it cann't be compiled.Incorrect.
SQL> create or replace procedure FunkyFoo is
  2          i       integer;
  3  begin
  4          i := 123;
  5 
  6          begin --// block not required - used for readability
  7                  declare
  8                          i       integer;
  9                  begin
10                          i := 321;
11                          dbms_output.put_line( 'i='||i );
12                  end;
13                  dbms_output.put_line( 'i='||i );
14          end;
15 
16  end;
17  /
Procedure created.
SQL>
SQL> exec FunkyFoo
i=321
i=123
PL/SQL procedure successfully completed.
SQL>

Similar Messages

  • Executing PLSQL statements on Oracle SQL Developer

    Hello All,
    I am trying to execute following PLSQL statements through SQL Developer:
    DECLARE
    myvar VARCHAR2(30);
    BEGIN
    myvar := 'TEST NAME';
    DBMS_OUTPUT.PUT_LINE(myvar);
    END;
    But nothing is being displayed. And when I execute the same on SQL*Plus, the output is properly being displayed.
    How can I a make it work on SQL Developer also.

    hi
    try this ......
    set serveroutput on;
    DECLARE
    myvar VARCHAR2(30);
    BEGIN
    myvar := 'TEST NAME';
    DBMS_OUTPUT.PUT_LINE(myvar);
    END;
    if it is correct then please make it correct /helpful
    Thanks
    shyam~

  • Limit users to execute "SELECT" statemes only from SQL Developer

    Hi:
    Is there a way to control what SQL command can be executed from SQL Developer?
    I am trying to limit users to execute "SELECT" statements only from SQL Developer.
    I believe SQL*Plus used to have the product profile where I can control what SQL command can be executed from what user.
    Thanks in advance.

    There's nothing special in sqldev to enforce privileges, the database does all that already. See the database documentation on the GRANT and REVOKE statements. Basically, you would only want to grant SELECT privileges to your users...
    Have fun,
    K.

  • SSRS - Oracle Stored procedure returns no data but does in SQL Developer Sudio

    HI there,
    Stored procedure returns no data when executed on the report but when i execute the stored procedure in Sql Developer it returns required rows.
    Thanks for your help!

    Hi Simon,
    When i test with simple query, i get the data.
    For your convenience, my stored proc looks lyk :
    PROCEDURE pr_REPORT_data(P_STARTDATE IN DATE, P_ENDDATE IN DATE, data_rows OUT T_CURSOR) AS 
    OPEN completed_Reinstatement FOR
      SELECT 
                 value1,.......value5
      FROM table1
    WHERE
        To_Date(createdDate, 'YYYY/MM/DD') BETWEEN To_Date(P_STARTDATE, 'YYY/MM/DD') AND To_Date(P_ENDDATE, 'YYYY/MM/DD');
    END pr_REPORT_data;          
    T_CURSOR is of type cursor which is declared on the package.
    I'm assuming the problem is with date parameters, however i converted the date before passing to
    WHERE clause. 

  • Nls_date_format in SQL Developer

    Hello all,
    the fields from data type DATE are shown in format 'DD.MM.YY' .
    There ist a possibility to change this using the statement
    alter session set nls_date_format='DD.MM.YYYY HH24:MI:SS'
    I have to write this always when I establish a new database connection. I'd like to have this representation for all connections.
    Is there a way to execute this statement at starting SQL-Developer or at connecting?
    Thanks in advance for your answer!
    Regards,
    Tzonka

    There will be a preference for this in 1.1, not yet released. For SQL Developer 1.0 there are various workarounds for this. A number of threads in this forum have already responded to this. Here is one:
    Re: Alter session command on start-up
    Regards
    Sue

  • Query returns record in SQL Developer but not in iSQLPlus

    ... back in a minute, I may not have done a commit at the end of the insert.
    The problem I was having was I hadnt commited the record in SQL Developer but the queries where returning records in this environment but not in iSQLPlus or Apex and it was confusing me.
    Message was edited by:
    Benton
    Message was edited by:
    Benton

    Finally got to know the reason why Timezone Abbr woudn't show up in SQL Plus.
    I ran below query in SQL PLUS
    SELECT SESSIONTIMEZONE, CURRENT_TIMESTAMP, systimestamp, LOCALTIMESTAMP FROM DUAL;
    SESSIONTIMEZONE CURRENT_TIMESTAMP SYSTIMESTAMP LOCALTIMESTAMP
    -05:00 08-SEP-12 12.00.31.575228 AM -05:00 08-SEP-12 12.00.31.575223 AM -05:00 08-SEP-12 12.00.31.575228 AM
    Now executed the same query in SQL Developer:
    SESSIONTIMEZONE CURRENT_TIMESTAMP SYSTIMESTAMP LOCALTIMESTAMP
    America/Chicago     08-SEP-12 12.08.32.072424000 AM AMERICA/CHICAGO     08-SEP-12 12.08.32.072420000 AM -05:00     08-SEP-12 12.08.32.072424000 AM
    The difference between the 2 outputs is the way in which time_zones were respresented. In SQL PLUS, it is shown as an offset whereas in SQL Developer as a time zone region name. Now there are many "time sone regions" that follow an offset of -5:00. This confuses Oracle and a "UNK"(Unknown) for a query like the one below when trying to execute in SQL PLUS:
    select extract(timezone_abbr from from_tz(cast(sysdate as timestamp),SESSIONTIMEZONE)) from dual;
    EXTRACT(TI
    UNK
    Therefore we need to specify the exact Time Zone Region(TZR) in order to obtain the corresponding TZD(Daylight Savings Format i.e. CDT or CST). This we do by altering the session environment vaiable time_zone
    alter session set time_zone='America/Chicago';
    Now executing the queries to find the abbreviated time zone( in TZD format) will finally work to return a non-null char value.
    select extract(timezone_abbr from from_tz(cast(sysdate as timestamp),SESSIONTIMEZONE)) from dual;
    EXTRACT(TI
    CDT
    select to_char(CURRENT_TIMESTAMP, 'TZD') from dual;
    TO_CHA
    CDT

  • Error while executing query in SQL Developer

    I am getting the following error whenever I login to sql developer.
    SEVERE 56 0 oracle.jdbc Error while registering Oracle JDBC Diagnosability MBean.
    I get below error whenever I execute any query.
    SEVERE 70 53918 oracle.dbtools.worksheet.sqlhistory.SqlHistoryTask oracle.dbtools.worksheet.sqlhistory.db.HistoryDB.readHistory(HistoryDB.java:99)
    I use following versions
    Java(TM) Platform 1.6.0_35
    Oracle IDE 3.2.20.09.87
    Versioning Support 3.2.20.09.87
    I am working on Oracle11gR2.
    Please help me to resolve this and let me know if you need more information.

    Got same issue with :
    Component
    Version
    =========
    =======
    Java(TM) Platform
    1.6.0_41
    Oracle IDE
    3.2.20.09.87
    Versioning Support
    3.2.20.09.87
    Alternate path for SqlHistory directory :
    C:\Users\USER_NAME\AppData\Roaming\SQL Developer
    Best Regards,
    F.L.

  • How to execute command(program) from external file in Oracle SQL developer

    Hi,
    Does anyone know, Oracle SQL developer version 1.0.0.14.67 got any function that can execute command from an external file?
    Example, i have 100 insert SQL inside a text file,
    and i want to use Oracle SQL developer to execute it. How do i read from my text file? Thanks a lots.

    If you're new to Oracle, do yourself and us a favour: read some tutorials and manuals. What sqldev's worth, better download the latest version (1.1.2), lots of fixes and enhancements...
    Now for the big popper: to run an external file: @file
    Best of luck,
    K.

  • Executing procedure with IN OUT parameters using SQL developer

    Hi, I'm trying to exceute the below procedure in SQL developer. Here the IN OUT cursor 'journal_cursor' is already defined.
    PROCEDURE LIST_FORPROJECT (
              p_project_sid IN NUMBER,
              p_journal_cursor IN OUT journal_cursor,
         AS
         BEGIN
              OPEN p_journal_cursor FOR
              -- get the journal
                   SELECT j.JOURNAL_KEY AS "Journal_SID",
                             j.JOURNALTEXT AS "Entry",
                             j.CREATEDATE AS "CreateDate",
                             --j.COMMENT_ AS "Comment",
                             j.PROJECTPHASETASK_KEY AS "ProjectPhaseTaskSet_SID",
                             j.person_key AS "Person_SID"
    FROM vdl_JOURNAL j
                   INNER JOIN vdl_PROJECTJOURNAL pj ON pj.JOURNAL_KEY = j.JOURNAL_KEY
                   WHERE pj.PROJECT_KEY = p_project_sid
                   ORDER BY j.CREATEDATE ASC, j.JOURNAL_KEY ASC;
    END LIST_FORPROJECT;
    When trying to run the above procedure through SQL developer, I get the below code generated.
    DECLARE
    P_PROJECT_SID NUMBER;
    P_JOURNAL_CURSOR journal_cursor;
    BEGIN
    P_PROJECT_SID := 5974;
    -- Modify the code to initialize the variable
    -- P_JOURNAL_CURSOR := NULL;
    -- Modify the code to initialize the variable
    LIST_FORPROJECT(
    P_PROJECT_SID => P_PROJECT_SID,
    P_JOURNAL_CURSOR => P_JOURNAL_CURSOR,
    -- Modify the code to output the variable
    DBMS_OUTPUT.PUT_LINE('P_JOURNAL_CURSOR' || P_JOURNAL_CURSOR);
    END;
    But executing the above sql doesn't print the cursor as output but errors out saying 'wrong number or type or arguments in call to ||'. Can somebody please help me in finding a way test and view the results of such a procedure through SQL developer?
    Any help is highly appreciated.
    Regards,
    Ranganath

    Hi,
    I was able to solve the problem.. My cursor was declared like this.
    TYPE journal_def IS RECORD
              journal_sid                    NUMBER(10),
              journaltext                    CLOB,
              createdate                    DATE,
              projectphasetaskset_sid     NUMBER(10),
              person_sid                    NUMBER(10)
    TYPE journal_cursor                    IS REF CURSOR RETURN journal_def;
    I used the journal_def type to fetch the records.
    Here is how my final sql looked like.
    DECLARE
    P_PROJECT_SID NUMBER;
    P_JOURNAL_CURSOR journal_cursor;
    P_J_CURSOR journal_def;
    BEGIN
    P_PROJECT_SID := 11171;
    -- Modify the code to initialize the variable
    -- P_JOURNAL_CURSOR := NULL;
    LIST_FORPROJECT(
    P_PROJECT_SID => P_PROJECT_SID,
    P_JOURNAL_CURSOR => P_JOURNAL_CURSOR,
    -- Modify the code to output the variable
    BEGIN
    --open P_JOURNAL_CURSOR;
    loop
    fetch P_JOURNAL_CURSOR into P_J_CURSOR;
    exit when P_JOURNAL_CURSOR%NOTFOUND;
    DBMS_OUTPUT.put_line(P_J_CURSOR.journal_sid);
    end loop;
    --close P_JOURNAL_CURSOR;
    END;
    END;
    This gave me results. Thanks a ton ALL for your help..... :)..
    Regards,
    Ranganath

  • How to Execute SQL Server stored procedure through SQL Developer?

    Hi,
    I was successful in connecting SQL Server database using SQL Developer. I am able to see all the objects such Tables,Views & Procedure and also can query data using sql Query. But when it comes to executing procedure there's no option to achieve this. I tried "Exec |<Execute Procedure> Proc_name" but unfortunately both statement threw Errors.
    Please suggest about other alternates.
    Thanks in Advance,
    AP

    Hi,
    I was successful in connecting SQL Server database using SQL Developer. I am able to see all the objects such Tables,Views & Procedure and also can query data using sql Query. But when it comes to executing procedure there's no option to achieve this. I tried "Exec |<Execute Procedure> Proc_name" but unfortunately both statement threw Errors.
    Please suggest about other alternates.
    Thanks in Advance,
    AP

  • Oracle SQL Developer for OSX not able to compile/execute/handle packages?

    Hi,
    Have been stuck with this for quite some mins now,
    When I execute this simple -valid- create package statement in Oracle SQL Developer:
    http://www.pastebin.ca/757859
    It shows it's not compiled and has errors, when I check the Packages part in Oracle SQL Developer I see this:
    http://www.pastebin.ca/757860
    The ; after end has been removed by the application. In fact this means I can't do anything with packages in Oracle SQL Developer for OSX?
    Is this a known bug?
    Or am I doing something wrong?
    Any resolving response to this matter would be really appreciated.

    Yeah, that bug is in there since stoneage, and is really a no-brainer to fix. Until they don't, we'd be losing time recompiling.
    FWIW, everything works fine using the procedure editor for creating, editing and compiling.
    Regards,
    K.

  • Executing a procedure - Works on Isql Plus but not SQL Developer??

    Hi folks.
    I am playing around with some design and structure stuff, mostly just passing values around procedures. I have one procedure (procedure1) which takes a sysdate and then passes it to another procedure (procedure2) which takes the parameter and does a dbms_output.put_line.
    Both objects are valid, and compile correctly. I use
    exec procedure1;
    in iSql Plus and it works perfectly. It prints the dates out and all.
    However if I use the exact same command in SQL Developer it gives me error "ORA-00900: invalid SQL statement"
    I don't understand why this happens?? The code executes perfectly in one but not the other...

    Remember that SQL*Plus commands don't work in the worksheet. So, this would fail
    exec my_procIn the worksheet you have to declare an anonymous block....
    begin
        my_proc;
    end;
    /If you right-click on the procedure in the Navigator and select Run then SQL*Dev will throw up a harness for you. Very handy if you want to get DBMS_OUTPUT, set variables, etc.
    Cheers, APC
    http://radiofreetooting.blogspot.com

  • Sql developer 3.0 executable does nothing when running

    I just downloaded SQL Developer 3.0 and extracted it to an empty folder. After extracting I have tried to open/run the sqldeveloper.exe and nothing happens. I have tried downloading the program again and extracting the files a couple more times and get the same results. What do I need to do to get the executable to work?
    My system I have downloaded it to and trying to run it on is Microsoft Windows XP Professional Version 2002 Service Pack 3.
    Ron Bich
    P.S. if Sue Harper is reading this, just want to let you know that I missed you at Training Days this year! It has been nice having you attend the last couple of years....

    India eh! From the sounds of it for a vacation and I am sure it was one well deserved. Hope you got a chance to work on your meditation, I hear they have some of the best masters to work with progressing on your journey to enlightenment with the known universe. I started meditating using Tantric practices with Chakra humming a little over a year ago which provides me with a fresh start and a relaxing finish to my days!
    Got this issue fixed, figured it was something simple to fix. I look forward to seeing you again when your in town Sue!

  • ProC Compiler & SQL Developer

    Hi,
    I am new to proc and oracle. I have installed 10g Express edition, but it does not have proc compiler.
    Currently I am downloading SQL Developer, does it come with a proc compiler?
    Is there anywhere I can get a proc compiler?
    Really appreciate the help.
    OS : Ubuntu 9.10
    Thanks and Regards,
    Ahamed.

    thanks for the reply...
    So you mean SQL developer indeed has a proc compiler is it?...
    Thanks for your time.
    Regards,
    Ahamed.

  • SQL Developer cannot execute multiple queries in one connection

    Hi,
    Using : SQL Developer 1.2.29.98, Oracle Database 9i on Windows XP.
    Currently I have TOAD and PL/SQL Developer to handle things related to Oracle Database.
    I found this SQL Developer tools as an interesting tool which might replace PL/SQL Developer (I assume).
    I opened two SQL Worksheets and tried to execute 2 queries (time consuming one) simultanously, suddenly it freezes (the window become grayed). Just like TOAD, we cannot smoothly execute multiple queries on single connection on SQL Developer
    I can monitor the query process using TOAD (Session Browser) and found both queries are running while SQL Developer window become grayed and seems not functioning. After the queries have been finished, I mean both of them, the SQL Developer window become normal and "alive" again showing the expected results.
    Well, however PL/SQL Developer could handle this. Executing multiple queries in single application is just its unbeatable features.
    We can view the query result once its finished instead of until the others being processed, by just only switch the SQL Windows.
    Is it true that SQL Developer doesn't support executing multiple queries?
    Or is it a feature which we should request?
    Or we have to activate this feature by doing some changes on configuration / preferences?
    (Do we need to open two SQL Developer instances? what a memory consuming solution).
    Regards,
    Buntoro

    SQLDeveloper connections are single threaded and also rather single minded (in that you can't do much else while a long query is running.)
    There is an existing feature request http://apex.oracle.com/pls/otn/f?p=42626:39:3685254426061901::NO::P39_ID:4202 for which you can vote.
    The workaround is to have multiple connections. Not brilliant but it works.

Maybe you are looking for

  • Can i upgrade my macbook pro i5 to a i7 without buying the i7 module?

    so I stay on amazon when it comes to new components for my MacBook Pro, just to see the products that could potincally help me operate the system batter or anything along those lines. So today I went on just to browse and stumbled upon the "intel cor

  • How do I change a name of a button in a Flash movie?

    Hello everybody, I'm newbie with Flash and I have a problem. I have a flash movie, which I want to use as a header for a website. When I play the movie, I have 5 different buttons on it. When I open through Flash the .fla file it shows me that there

  • Boolean Problems

    I have made a GUI using Javax Jframe etc and on it i have a JCheckbox. My problem is that when i try to save the values of the textbboxes on the JFrame and the checkbox, i cant get the value of the checkbox to save. I dont know how to get the value o

  • I cannot connect my sony nex 5n to my imac lion, why?

    I cannot connect my sony nex 5n to my iMAC Lion, why?

  • T-sqL Query Help

    Hi I have one table that is having following data Table : Test  Code    Amount    1      200    1      500    2      600    3      900    3      1000 Table : codeDesc IdentityColumn       Code   CodeDes 1                     1     Purchase 2