From TOAD to Sql Developer

Hi,
I've been a TOAD user for more then 5 years, now our office is switching us to SQL Developer. Is there a way, in SQL Developer, to display the content of a REF CURSOR? If so, how is it done?
Thanks in advance,
Marc

Hi Marc,
From SQL Developer's Help menu (used version 3.0.04.34), just click on Search and enter "ref cursor". One result with a nice REF CURSOR example is "Cursor Variables". Scroll down to "Example: Fetching Data with Cursor Variable".
Or read more about it on the SQL and PL/SQL forum:
PL/SQL 101 : Understanding Ref Cursors
Or, as a quick example, create a function in the SCOTT schema that returns a sys_refcursor:
create or replace function get_employees return sys_refcursor as
ret_cursor sys_refcursor;
begin
open ret_cursor for
select * from emp;
return ret_cursor;
end get_employees;
Then, from a worksheet, use Run Script (the Run Statement produces a hard-to-read result for the select) on:
select get_employees() from dual;
or...
variable v_ref_cursor refcursor;
exec :v_ref_cursor := get_employees();
print :v_ref_cursor
Regards,
Gary Graham
SQL Developer Team
Edited by: gggraham on Jul 28, 2011 1:44 PM

Similar Messages

  • Using TOAD and SQL Developer to compare db objects in schemas in databases

    Hi All,
    My primary objective was to compare objects in schemas in two different databases and find out the differences,
    Execute DDL's in the database where objects are missing and syn schemas in two different databases.
    So I need to compare schemas in databases. Which tool would be helpful and will be user friendly to make a comparison of database objects existing in schemas in two different databases.
    I'd like to see if I can get a list of pro and cons between Toad and SQL Developer for comparing schemas pros and cons.
    Could you please also help me on navigation in SQL Developer to compare schemas.
    Connect to Source
    Connect to Target
    Compare schemas with different object types
    Find out differences
    Generate DDL's for the missing objects or for the objects in difference report
    Run them in missing instace(Source/Target)
    Make sure both are in sync.
    Thanks All

    Hi,
    Most dba type tools have this kind of functionality - personally i use plsqldeveloper but this is very similar to most other tools on the market. SQL Developer seems to rely on you needing the change management pack licence which you likely dont have and would be quite a large cost to roll out.
    I'd compare plsqldeveloper/toad/sqlnavigator etc and maybe the tools from redgate which look pretty good though i haven't used them.
    Regards,
    Harry

  • Date Parameters Toad/Oracle SQL Developer

    Dear All, The code below works in TOAD but in the Oracle Sql Developer doesn't work it says the Start_date is not been declared. The ambersand doent work in Toad? Don't know why. Is there a reason for this.
    I have been using Toad for a while, now they're rolling out Oracle Sql Developer as it is a free tool.
    SET SERVEROUTPUT ON
    SET VERIFY OFF
    Variable start_date char(8);
    BEGIN
         :START_DATE := TO_CHAR(TO_DATE('&1','YYYYMMDD'),'YYYYMMDD');
    END;
    BEGIN
         DBMS_OUTPUT.PUT_LINE(:START_DATE);
    END;
    Edited by: user531731 on 23/07/2009 17:18
    Edited by: user531731 on 23/07/2009 17:19

    My recommendation would be to write it correctly no matter the tool.
    SQL> DECLARE
      2    START_DATE VARCHAR2(8) := TO_CHAR(TO_DATE('&1','YYYYMMDD'),'YYYYMMDD');
      3  BEGIN
      4    DBMS_OUTPUT.PUT_LINE(START_DATE);
      5  END;
      6  /
    Enter value for 1: 20091010
    old   2:   START_DATE VARCHAR2(8) := TO_CHAR(TO_DATE('&1','YYYYMMDD'),'YYYYMMDD');
    new   2:   START_DATE VARCHAR2(8) := TO_CHAR(TO_DATE('20091010','YYYYMMDD'),'YYYYMMDD');
    20091010
    PL/SQL procedure successfully completed.
    SQL>

  • Create Trigger (PK from Sequence) in SQL Developer 1.5.1

    Hi all
    I'm new to Oracle and am trying to create the equivalent of an autonumber field on a table using the Create Trigger (PK from Sequence) option (by right clicking on a table in SQL Developer).
    I've set up a sequence called REQUESTID and when using the above option it generates the following SQL:
    begin
    execute immediate 'create or replace trigger AutoNumber '||
         ' before insert on "REQUEST" '||
         ' for each row '||
         'begin '||
         ' if inserting then '||
         ' if :NEW."REQUESTID" is null then '||
         ' select REQUESTID.nextval into :NEW."REQUESTID" from dual; '||
         ' end if; '||
         ' end if; '||
         'end;';
         end;
    When I click Apply I get an ORA-00942 (table or view does not exist). Am I doing something daft here?

    Never mind - sorted it - I created the table under a different Schema to the System login being used in SQL Developer and so didn't have the permissions to create the trigger on the table.

  • Migration from Access with SQL Developer 1.2.2998 Does not migrate Relation

    Hi,
    I've almost successfully migrated an Access database to Oracle with SQL Developer with Quick Migration Option. Everything went all right, except for the tables relationships... they were not migrated. Have I forgot to do something?
    Thanks in advance.
    PS: Using SQL Developer 1.2.0.29.98, Oracle 10g XE, MS Access 2000 file.

    Hi All,
    This is a bug which crept in just prior to release. It has been found, and a fix has been commited to our source tree. The fix will be available in our next patch release. (1.2.1).
    Regards,
    Dermot.

  • Pausing and resuming a PL/SQL proc from oracle PL/SQL DEVELOPER tool

    I need to test a PL/SQL on how it reacts to an exception. I need to PAUSE it, do something outside of the proc and then resume the proc. Is there a PROMPT command in PL/SQL where it would wait for user input? Can I use DBMS_OUTPUT.GET_LINE to do this? Where does the GET_LINE raed its input from?

    Perhaps the following demo will help. It uses straight SQL, since the PRIMARY KEY stuff does not require any sort of PL/SQL.
    I set up 2 sessions in SQLPlus.
    Session 1 - create a table with a primary key, insert and do not commit:
    session 1:
    C:\Users\Hans>sqlplus test/test
    SQL*Plus: Release 10.2.0.1.0 - Production on Sat Oct 10 15:40:13 2009
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    SQL> create table abc ( a number primary key enable);
    Table created.
    SQL> insert into abc values (1);
    1 row created.Go to session 2 and insert:
    C:\Users\Hans>sqlplus test/test
    SQL*Plus: Release 10.2.0.1.0 - Production on Sat Oct 10 15:36:45 2009
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    SQL> insert into abc values (1);it hangs here.
    Switch back to session 1 and commit;
    SQL> commit;
    Commit complete.
    SQL>and in session 2 I see
    insert into abc values (1)
    ERROR at line 1:
    ORA-00001: unique constraint (TEST.SYS_C006468) violated
    SQL>Trying this for different test cases: session 1 insert value (2) and session s, insert value (3)
    Session 1
    SQL> insert into abc values (2);
    1 row created.
    SQL>Session 2
    SQL> insert into abc values (3);
    1 row created.
    SQL>Back to session 1
    SQL> commit;
    Commit complete.
    SQL>Back to session 2
    SQL> insert into abc values (3);
    1 row created.
    SQL>So I conclude that dups will block during insert.
    For your original question - SQL and PL/SQL are run in separate engines. PL/SQL sends the SQL command to the SQL engine, which runs that and returns any return info (rowset, error, ...).
    So any questions about SQL and SQL transaction control may be handled in a purely SQLPlus (or TOAD or SQLDeveloper) test case.
    OTOH, questions about PL/SQL can be answered using a debug environment such as SQLDeveloper - see http://www.oracle.com/technology/obe/sqldev/plsql_debug/plsql_debug.htm

  • Differences between TOAD for Oracle and Oracle SQL Developer?

    Does someone know the advantages and disadvantages of using TOAD for Oracle and Oracle SQL Developer?
    I work making reports with TOAD, but in a few days I will have to use the SQL Developer (because it´s free) unless I justify the necessity of using TOAD.
    Could some that used both compare them?
    Thanks,
    Facundo.

    Hello Facundo,
    since we are rolling out new client PCs we switch from Toad to SQL Developer. Therefore I'm doing some training for the "normal" users and our developers.
    Most users simply want to have access to the data in tables and views. For those there are 2 main issues:
    - Filters get lost when exiting table while sorting is still applied. Since there is no way to apply filtering before entering the data tab this can become a great performance issue because sorting is applied to many many rows. For views it is sometimes impossible to open the data tab.
    - Exporting date values to Excel needs some know how if you want to sort by this column in Excel, because the date is formatted as "Standard" meaning that the sorting is done as for a text column: 01.01.2009 is less than 02.01.2008. Here you have to use a workaround column with a formula (=1*<datecolumn>)
    The greatest Pro is the easy sharing of connections and reports by XML files.
    Our developers like the easy debugging in SQL Developer. Though they miss the feature that the source is compiled for debug automatically as in Toad. For this we have distributed a script that compiles any PL/SQL object for debugging.
    There are only some Toads installed for DBAs and for users that need access to tables protected by policies that require authentification by OS user since this information is not passed under every circumstance.
    Regards
    Marcus

  • SQL Developer vs TOAD: connection stability

    I am trying to persuade a group of developers to switch from TOAD to SQL Developer. The feature set of version 1.5 is quite nice; and most of our users don't need the extra bells and whistles of TOAD. However, in side-by-side situations, it seems that TOAD gets better response times. In particular, the connection for SQL Developer sometimes seems to freeze and then come back later, while TOAD does not seem to be affected.
    Our DBA thinks that the difference may be from SQL Developer using a JDBC connection while TOAD uses Oracle SQLNET. He said that switching to an LDAP server for name resolution might make the difference; but we really don't have much experience at this level of detail on the connections.
    Is anyone else having a similar issue? Has anyone been able to 'equalize' the performance of the two products?
    You insights are welcome.

    However, in side-by-side situations, it seems that
    TOAD gets better response times. In particular, the
    connection for SQL Developer sometimes seems to
    freeze and then come back later, while TOAD does not
    seem to be affected.
    Our DBA thinks that the difference may be from SQL
    Developer using a JDBC connection ... I think the problem ist not SQL Developer\JDBC itself but rather the Java Runtime Environment. The behavior you describe sounds like that Garbage Collector hits you. SUN trys to make the GC better in each Java version, so I suggest you update your JRE to the newest one you can get(today: 1.6.0_06 from java.sun.com).
    After doing that, install "Oracle SQL Developer for Windows, with JDK already installed" to make sure that SQL Dev. use the new one. You can check the used java version within SQL Dev. at the "About" dialog (register: version)
    If you are familiar with java you should play with some gc and memory settings. Details about that you find here: http://java.sun.com/docs/hotspot/gc5.0/gc_tuning_5.html
    Andreas

  • SQL Developer Session Browser?

    Does SQL Developer have any counterpart of TOAD's Session Browser (to see who else is hitting the database and with what queries)?

    Thanks to both of you! This forum rocks! I am in the process of putting together a recommendation that we move from TOAD to SQL Developer; and tracking down some of the most-loved TOAD features in SQL Developer is sometimes difficult for a newbie like myself.
    Again, many thanks!
    Dave

  • Changing password within SQL Developer

    Hi, Thanks for the great product. I'm beginning to migrate from TOAD to SQL Developer and have run into one minor snafu. The one minor feature missing within SQL Developer (unless I missed it) is to easily change a password like TOAD in the UI (This is a common complaint among other devlopers trying it out). I work on a lot of seperate databases occasionally and have to reset the passwords every 60 days.
    I would like to request this minor feature.
    How can I change my password without using SQL Plus, but within SQL Developer? Is there a way?
    Thank you!

    Sounds like a good enhancement and I will record it. In the meanwhile, just open a SQL Worksheet and issue your command.
    -- Sharon

  • Oracle SQL Developer O/P and Toad O/P is Different for Same QUERY.

    Hi,
    can any one calrify me why i'm getting different result when i run the same QUERY in Oracle Developer and TOAD.
    When i Ran a Query in TOAD i could see Null&Data in a column called Customer_Category but when i Ran the same Query in Oracle SQL Developer i'm getting all Null N i couldnt see any data in the column.
    i have not performed any DDL r DML statement, just i got the Query and i Ran it in TOAD & Oracle SQL Developer.
    I found that the OUT PUT is different for perticular column.
    Thanks in Advance....

    > I found that the OUT PUT is different for perticular column.
    The RENDERING of data from Oracle (or any other server such as a POP3 server, web server, etc) IS DONE BY THE CLIENT.
    So to repeat - RENDERING IS DONE BY THE CLIENT.
    If one client selects to display the output received from the server differently than another client, it is a CLIENT ISSUE.
    It is not a server issue. It is not a SQL issue. It is not a PL/SQL issue.
    In other words, wrong forum for this question. You have a pure client side rendering problem which has absolutely nothing to do with SQL and/or PL/SQL.

  • Oracle SQL developer tool vs toad

    Hi - I am trying to do a feature comparison on these 2 tools and am not very familiar with them could someone please tell me if Oracle SQL developer tool has these features:
    Project Manager
    Result Set Compare
    Chart Designer
    Toad Report Wizard
    Pivot & Chart
    Data Compare and Synch
    Automation
    Simple Cross-Platform Queries
    Advanced Cros-Platform Queries
    Local Data Storage
    Data Transformation and Cleansing
    Data Browser
    ER Diagrammer
    Charts & Pivot Table Reports
    Automation & Scheduling Engine
    Data Compare & Sync
    Cross-connection Query

    Hi!
    I have worked with several Oracle IDE's in the past:
    * TOAD
    * PL/SQL Developer
    * Navigator
    * SQL/Developer
    Right now I tend to do most of my work with SQL-Developer and only some tasks with TOAD.
    SQL-Developer feels faster and has a cleaner interface than TOAD, while TOAD has better tools.
    Im currently publishing a series of tips for SQL-Developer in my blog:
    http://oracledeli.wordpress.com/
    Some of the posts are focussing on overcomming SQL-developers disadvantages versus TOAD:
    * SQL-Developer: Using macros http://oracledeli.wordpress.com/2011/09/28/sql-developer_using_macros/
    * Execute current worksheet file via SQL*Plus (external tools) http://oracledeli.wordpress.com/2011/09/23/sql-developer_execute_via_sqlplus/
    Best regards,
    Matt
    Best regards,
    Matt

  • SQL Developer import from Excel or CSV not creating new table

    I am sure I have done this with previous version of SQL Developer. I am now running 1.5.4 with patches update from 5/27/2009. I am running on Windows XP. When I start the import wizard I get to the point were the varify button appears. I click Verify. Everything is successful. The next button is grayed out. The send to worksheet is not checked. I press the finish button and the new table is not created.
    I don't get any error message. I refresh my table list and the new table is not created. I can create new tables using SQL Developer so I don't think it can be a privelege problem. I know I did this a few weeks ago. I am not sure what version of SQL Developer I was running. But I have updated to the latest and greatest since then.

    I wanted to import and use my table data from MS Excel 2010 in SQL developer Version 3.1.05.
    I was told that SQL does not import .xls data. For that reason, I was searching for a script which Import data from excel to SQL developer. I tried many different forums DBS blogs. Then eventually I found the solution inside the SQL developer itself.
    In your Editor window, There would be options like,
    1. Columns | Data | Constraints |Grants | Sta...... "so on"
    2. In second row, you can find a drop box with certain table options. Select the last option "Import Data"
    THERE YOU GO.
    do accordingly to your need and you will get the data as well its scripts.
    I hope this would help you all. Thanks. :-)

  • Migration from Access to Oracle through SQL developer

    Hi,
    I want to migrate an mdb file which contains a set of tables to oracle. During this process, i have created schema and all the tables in Oracle using DDL scripts. I would like to transfer only the data to Oracle from access through SQL developer. How can I do that?
    Regards,
    Meena

    Hi Meena,
    You mention that you have created the schema and tables in Oracle using DDL scripts. Did you use the Oracle SQL Developer Migration Workbench, creating a Migration Repository, to carry out this process? I see from your other postings that you are experiencing issues using the Exporter tool, which would lead me to believe that you haven't used the Migration Workbench to migrate your database. Obviously you will need to resolve your Exporter issues before you can proceed to the next phase of the migration process. I will aim to assist you with those issues on the seperate thread - ShowSplashScreen("_OracleSplashScreen",3) error The XML file generated by the Exporter tool forms the basis of your MS Access migration.
    In order to migrate your data from MS Access to Oracle using the Migrate Data option in Oracle SQL Developer, you will need to have access to the Migration Repository used for the migration of the MS Access database. The information contained in the Converted Model, in the Migration Repository, is used during the data migration process. The data migration requires the following connections:
    1. a source database connection i.e. a database connection to the MS Access MDB file
    2. a target database connection i.e. a database connection to the migration Oracle schema
    3. a Converted Model connection
    For further information on the creation of a Migration Repository, and the migration process, please refer to the accompanying documentation available via the online Help within Oracle SQL Developer, and also from OTN - http://download.oracle.com/docs/cd/E10405_01/doc/nav/portal_booklist.htm.
    I hope this helps.
    Regards,
    Hilary

  • SQL Developer from JDev

    I am doing the « Database Development with JDeveloper » tutorial. In the tutorial we create two SQL scripts that we can run with SQL*PLUS from inside JDEV. The tutorial asks us to use sqlplusw.exe. However I don’t have sqlplusw, I only have sqlplus.exe, the command line version.
    When I saw SQL Developer was claiming “Oracle SQL Developer is a graphical version of SQL*Plus” (First sentence of Online Help), I naively thought that I could use sqldeveloper.exe instead of sqlplusw.exe.
    When I try to run the SQL script from JDEV, it seems to open an empty SQL Developer window in JDEV, with no possibilities of running scripts.
    I know that in the next version of JDev SQL Developer should be integrated but, in the mean time does anyone know a way to open and run a SQL script from JDEV using SQL Developer as the tutorial requires it?
    I'm not sure if this makes sense.
    Message was edited by:
    dfullum

    You can use the sqlplus.exe instead of the sqlplusw.exe the results should be the same.

Maybe you are looking for

  • Configure Database Control web page in MSCS Failover Cluster

    I have a two-node windows 2000 cluster that is managed with Microsoft Cluster Services and Oracle FailSafe Manager. The cluster works fine, so does connecting to the database with SQL; however, I have been unable to use the database control EM web pa

  • Want to restrict the vendor at plant level

    Hi Experts, As per standard SAP, once the vendor is extended to comapny code then buyer can place order in any plant of same company code. My client wants to restrict the use of vendor at plant and after some business approval, will allow to use the

  • Does an external cnt file need to be in the same folder as the master cnt file?

    I'm working in RoboHelp Word and have inserted two external cnt files into a master cnt file. I've selected the option 'use full path' as the external help file is installed under a different folder than the master help file. However, I am unable to

  • Menu images appear blurry

    I am using the "Reveal" theme which has several images along the left side and each of those images is pixilating even though the image size is 740x495 150dpi and RGB. The images appear OK on a TV screen but very pixilated on both Macs and PCs. How c

  • Duplicate method (CS2 and CS3)

    Hi, I asked a question about duplicating images from one document to another that didn't exist on the local drive anymore. I tried someones suggestion to duplicate the box containing the image, to the other document, then setting the new box's proper