Define Statements in SQL Developer

Hi,
I'm really new to SQL Developer and I'm having one or two issues.
The most annoying is to do with Define statements.
Say I have the following script to run -
define p_start_date = TO_DATE('01-Jan-2010','DD-Mon-YYYY');
SELECT &&p_start_date
FROM dual;
What I find is that putting the cursor before the first define and then hitting the 'Execute Statement' button does nothing. No output is given.
I have to press the 'Run Script' button instead which does work, but the output is given in the 'Script Output' tab rather than the 'Results' tab, which is where I really want to see the results.
I can then however, go back and press the 'Execute Statement' button, and it now works. But, if the define date is changed, it wont be picked up until I press 'Run Script' and go through the whole process again.
Is there anyway I can just open a file with a define, press Execute and get results? Or is this just how SQL Developer works?
I'm on version 1.5.1 and previously used SQL Navigator which ran this type of issue without any problems.
Thanks for any help.

The problem is in understanding what each does:
'Execute Statement' (F9) executes only the current statement(s); where the cursor is located or the one(s) you have highlighted.
'Run Script' (F5) executes all statement(s); from top to bottom or the one(s) you have highlighted.
So what you describe is the expected behaviour.
I do suggest you upgrade to the current 2.1.1 (or 3.0 EA3), for fixes and the ability to run more than one selected statement with F9, even to different grids.
Have fun,
K.

Similar Messages

  • Storing User defined reports in SQL Developer

    Hi All,
         I have created some user defined reports in SQL Developer. My company requested me to update the OS from Win XP to Win 7. I forgot to export those reports. I got my machine back, they said that the data is retained. Now i need to take those reports back. Can anyone tell me in which folder would SQL Developer stores the User Defined Reports by default? My bad I dont remeber the Report Name too.
    Can anyone help me on this?
    Boopathy vasagam

    Hi,
    You can check at location
    C:\Documents and Settings\<your_user>\Application Data\SQL Developer
    HTH

  • 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~

  • SQL Developer  Create Table Statement to ERD Visio Diagram

    I have the following Create table statement from SQL Developer and I am trying to generate an ERD Diagram using 2003 Visio. I was wondering what I need to do to convert the Create Table to an ERD Diagram Using Visio. Thanks
    CREATE TABLE “TT_TEAM”.”HR_REVOKED_SECURITY_ORGS”
    “ID” NUMBER NOT NULL ENABLE,
    “ACAT_CODE” VARCHAR2(6 BYTE) NOT NULL ENABLE,
    “APPR_SEQ_NO” NUMBER(3,0) NOT NULL ENABLE,
    “USER_ID” VARCHAR2(30 BYTE) NOT NULL ENABLE,
    “ACTION_IND” VARCHAR2(1 BYTE) NOT NULL ENABLE,
    “ACTIVITY_DATE” DATE NOT NULL ENABLE,
    “COAS_CODE” VARCHAR2(1 BYTE),
    “ORGN_CODE” VARCHAR2(6 BYTE),
    “POSN” VARCHAR2(6 BYTE) NOT NULL ENABLE,
    “MANDATORY_APPR_IND” VARCHAR2(1 BYTE),
    “APPR_POSN” VARCHAR2(6 BYTE),
    “ORGN_MANAGER” VARCHAR2(6 BYTE) NOT NULL ENABLE;

    I'm pretty Visio is a non-Oracle product.
    In the mean-time, you can easily import a DDL script file and create a relational model/diagram using SQL Developer. Use the Import feature and point to your CREATE TABLE script(s)

  • HOW TO : Writing simple scripts in SQL Developer??

    Here is a simple script I run in SQL*Plus...
    the first SQL prints the QCSID, the second script prompts for a SID which is the QCSID from the first SQL... once provided it gives me the output I want...
    I just cannot do this in SQL DEVELOPER..... or Can I?
    select distinct qcsid from v$px_session;
    select sid,serial#,qcsid,qcserial#,degree,req_degree from v$px_session
    where qcsid in (select qcsid from v$px_session where sid='&sid');

    Ganesh,
    Simple substitution and defines work in SQL Developer scripts.
    I think the problem with running your script is that the first query results are not displayed before the window asking for the '&sid' value. That is the output to the 'screen output' tab is buffered and not synchronized with additional pop up (or dialog) windows. Is that correct?
    Currently:
    You can use substitution variables in the f5 'Run Script' but no bind variables.
    You can use bind variables in the f9 'Execute Statement' but no substitution statements.
    You can use anonymous PLSQL blocks, and packaged functions and procedures, so you can store per session state in PLSQL packages.
    -Turloch

  • SQL Developer: Windows 7 64-bits double numerical entries

    I am using sql developer windows 7 64-bits version 64-3.2.20.09.87-no-jre.
    I am entering data directly on tables.
    Sometimes when I use numeric pad to enter numbers, double entries appears on the first digit.
    For example: entering 1234
    it appears 11234 - with first numeric entry appearing twice.
    This also happens with the past versions, different notebook brands.
    How do I solve this problem?

    997844 wrote:
    Hi can anyone advise
    The Problem
    We are currently using Oracle SQL Developer 1.2.1.3213 to administer to the oracle database, unfortunately, this version does not play well with a 64 bit environ. The current airbus standard for Oracle SQL Developer which is happy with Windows 7 64 bit is version 3.1.07, again unfortunately, this version does not support versions of the Oracle database less than I think it is 8. Budget precludes the option of upgrading to a newer version of dbase.
    The Question
    Is there a version of Oracle SQL Developer that will meet our needs for windows 7 while remaining on the same version of the oracle database, or are there other competing products that you could recommend that will fit the bill. The product will require a GUI I don’t want to go back to entering SQL at the command line.
    regards
    Kevin" this version does not support versions of the Oracle database less than I think it is 8."
    What do you mean by this statement?
    SQL Developer is just a client. Clients do NOT have to be exactly version matched to a database. I am running SQLDeveloper 3.2 on a Win 7 Pro 64-bit desktop and my databases are a mix of 10.2.0.4 and 11.2

  • Can SQL Developer 1.5 do this: auto uppercase for keyword when typing

    When I write any SQL code, I like keep all keywords uppercase. Is that possible to automatically change keyword to uppercase when I am typing the SQL statement in SQL Developer 1.5 without using "Formatter" feature? In lots of cases, I don't want to use "Formatter" to format my code; however, I still want all keywords auto converted to uppercase when I type the code.
    Thanks!
    Kevin

    Another thing to note is that you can use a key sequence (ctrl ' ) to switch the case while you are typing. Again, not what you are after, but allows you to change the case, without running the formatter.
    There is a new request on the Exchange for this, perhaps more will vote on that request.
    Sue

  • Statement terminator problems when exporting data with SQL Developer 3.2

    I've ran across what appears to be a bug with SQL Developer 3.2.20.09. If someone can let me know if this is indeed a bug, or just something I need to configure differently, please let me know.
    The problem is related to exporting a database as a SQL script, and terminator characters at the end of "create" statements, especially when columns have comments, and problems that occur when using SQLPlus to run the export script to create the tables. With the old SQL Developer 1.5.4, with the "Terminator" and "Pretty Print" options checked, statements like the following are generated:
    -- DDL for Type NUM_ARRAY
    CREATE OR REPLACE TYPE "NUM_ARRAY"
    IS TABLE OF NUMBER(20)
    -- DDL for Sequence MYTABLE_SEQ
    CREATE SEQUENCE "MYTABLE_SEQ" MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER NOCYCLE ;
    -- DDL for Table MYTABLE
    CREATE TABLE "MYTABLE"
    (     "MYTABLE_ID" NUMBER,
         "COL2" NUMBER,
         "COL3" NUMBER
    -- DDL for Table ANOTHERTABLE
    CREATE TABLE "ANOTHERTABLE"
    (     "ANOTHERTABLE_ID" NUMBER,
         "COL2" VARCHAR2(1024),
         "COL3" VARCHAR2(1024)
    COMMENT ON COLUMN "ANOTHERTABLE"."ANOTHERTABLE_ID" IS 'This is a comment.';
    When I then run the script using SQLPlus, everything works fine. However, with SQL Developer 3.2.20.09, with the same options enabled, the same statements are generated like this:
    -- DDL for Type NUM_ARRAY
    CREATE OR REPLACE TYPE "NUM_ARRAY"
    IS TABLE OF NUMBER(20)
    -- DDL for Sequence MYTABLE_SEQ
    CREATE SEQUENCE "MYTABLE_SEQ" MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER NOCYCLE ;
    -- DDL for Table MYTABLE
    CREATE TABLE "MYTABLE"
    (     "MYTABLE_ID" NUMBER,
         "COL2" NUMBER,
         "COL3" NUMBER
    -- DDL for Table ANOTHERTABLE
    CREATE TABLE "ANOTHERTABLE"
    (     "ANOTHERTABLE_ID" NUMBER,
         "COL2" VARCHAR2(1024),
         "COL3" VARCHAR2(1024)
    COMMENT ON COLUMN "ANOTHERTABLE"."ANOTHERTABLE_ID" IS 'This is a comment.';
    Notice all of the extra slashes in there. If a slash is not used as a statement terminator, SQLPlus treats slashes as a command to repeat the last SQL statement, which causes many errors about tables or sequences already existing. So, I tried removing the "Terminator" flag from the export options. This lead to statements that looked a bit more promising:
    -- DDL for Type NUM_ARRAY
    CREATE OR REPLACE TYPE "NUM_ARRAY"
    IS TABLE OF NUMBER(20)
    -- DDL for Sequence MYTABLE_SEQ
    CREATE SEQUENCE "MYTABLE_SEQ" MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER NOCYCLE
    -- DDL for Table MYTABLE
    CREATE TABLE "MYTABLE"
    (     "MYTABLE_ID" NUMBER,
         "COL2" NUMBER,
         "COL3" NUMBER
    -- DDL for Table ANOTHERTABLE
    CREATE TABLE "ANOTHERTABLE"
    (     "ANOTHERTABLE_ID" NUMBER,
         "COL2" VARCHAR2(1024),
         "COL3" VARCHAR2(1024)
    COMMENT ON COLUMN "ANOTHERTABLE"."ANOTHERTABLE_ID" IS 'This is a comment.'
    The big problem, though, is in the statement for the table with a comment. Notice that there are two statements, but there is not a semicolon after either of them. This unfortunately causes the "COMMENT" statement to be appended to the "CREATE TABLE" statement before being executed, which causes the table to not be created (which causes even more errors later on when the script attempts to populate the table with data).
    So, it would appear that this is a bug, but I'm not sure. Is there a way I can configure the export options to make SQL Developer export these statements like it used to in older versions?
    Thanks,
    -Bill

    >
    So, it would appear that this is a bug, but I'm not sure.
    >
    That would be a bug. Thanks for reporting it and providing the detailed example.
    >
    Is there a way I can configure the export options to make SQL Developer export these statements like it used to in older versions?
    >
    No.
    Leave the thread open. One of the developers for sql developer should be monitoring the forum and can provide more information.

  • AUTOTRACE stats different in SQL Developer vs SQL Plus

    Using SQL Developer 3.2.20.09, database is 11.2 on Linux. I'd like to know why I get different stats when using AUTOTRACE in SQL Developer vs SQL Plus. If I do the following in SQL Developer and in SQL Plus I get a very different set of stats:
    set autotrace on
    select * from emp;
    set autotrace off
    I run this with "run worksheet" in SQL Developer and I see this set of stats:
    Statistics
    4 user calls
    0 physical read total multi block requests
    0 physical read total bytes
    0 cell physical IO interconnect bytes
    0 commit cleanout failures: block lost
    0 IMU commits
    0 IMU Flushes
    0 IMU contention
    0 IMU bind flushes
    0 IMU mbu flush
    I do the same in SQL Plus and I see these stats:
    Statistics
    0 recursive calls
    0 db block gets
    7 consistent gets
    0 physical reads
    0 redo size
    1722 bytes sent via SQL*Net to client
    519 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    14 rows processed
    A very different set of stats. The stats in shown in SQL Plus seem to be much more useful to performance optimization over the one shown in SQL Developer. Why the different set of stats for each? Thanks.

    Cross-referencing to another recent thread on this topic:
    Re: set autotrace on statistics in sqldeveloper (oracle 11g) is wrong

  • Run sql statements in PL/Sql Developer without installing Oracle database?

    Hi all,
    I wish to ask is there any possibility to run Run sql statements in PL/Sql Developer without installing Oracle database?
    Regards.

    Hello Jimmy,
    this is the forum for the tool SQL Developer and, as the title says, *(Not for general SQL/PLSQL questions)*.
    PL/Sql Developer is not an Oracle tool, but from allound allroundautomations.
    And you need access to a database to run SQL statements. This does not need to be one installed by yourself.
    Regards
    Marcus

  • Desc table_name statements no longer running in sql developer

    simple desc statements like desc table_name; used to run in sql developer however they no longer work.
    It was working a few days ago and now the same statements dont return any results. The tables exist as I can run select statements fine just not desc table_name;
    Any ideas how this can be fixed?

    I haven't had problems with the "desc table_name;" functionality for a long time - do you know of anything that has changed since they were working a few days ago?
    If you run the following query with :1 being the table owner and :2 being the table name, do you get the columns listed?SELECT t.column_name "Name",
      DECODE(t.nullable,'Y',NULL,'NOT NULL') "Null",
      UPPER(t.data_type)
      ||
      CASE
        WHEN ( t.data_type = 'VARCHAR' OR t.data_type = 'VARCHAR2' OR t.data_type = 'RAW' OR t.data_type = 'CHAR' )
            AND ( t.data_length != 0 AND NVL(t.data_length,-1) != -1)
        THEN
          CASE
            WHEN(t.char_used = 'C' AND 'BYTE' = (SELECT value FROM nls_session_parameters WHERE PARAMETER = 'NLS_LENGTH_SEMANTICS' ))
            THEN '(' || t.char_length || ' CHAR)'
            WHEN(t.char_used = 'B' AND 'CHAR' = (SELECT value FROM nls_session_parameters WHERE PARAMETER = 'NLS_LENGTH_SEMANTICS' ))
            THEN '(' || t.data_length || ' BYTE)'
            WHEN(t.char_used = 'C' AND 'CHAR' = (SELECT value FROM nls_session_parameters WHERE PARAMETER = 'NLS_LENGTH_SEMANTICS' ))
            THEN '(' || t.char_length || ')'
            WHEN(t.char_used = 'B' AND 'BYTE' = (SELECT value FROM nls_session_parameters WHERE PARAMETER = 'NLS_LENGTH_SEMANTICS' ))
            THEN '(' || t.data_length || ')'
            ELSE '(' || t.data_length || ' BYTE)'
          END
        WHEN (t.data_type = 'NVARCHAR2' OR t.data_type = 'NCHAR')
        THEN '(' || t.data_length/2 || ')'
        WHEN (t.data_type LIKE 'TIMESTAMP%' OR t.data_type LIKE 'INTERVAL DAY%' OR t.data_type LIKE 'INTERVAL YEAR%' OR t.data_type = 'DATE' OR(t.data_type = 'NUMBER' AND (t.data_precision       = 0 OR NVL(t.data_precision,-1) = -1)))
        THEN ''
        WHEN (t.data_scale = 0 OR NVL(t.data_scale,-1) = -1)
        THEN '(' || t.data_precision ||')'
        ELSE '(' || t.data_precision ||',' ||t.data_scale ||')'
      END "Type"
    FROM sys.all_tab_columns t,
      sys.all_col_comments c
    WHERE t.column_name = c.column_name
    AND c.owner         = t.owner
    AND c.table_name    = t.table_name
    AND UPPER(t.owner)  = UPPER(:1)
    AND t.table_name    = :2
    ORDER BY t.column_idtheFurryOne

  • SQL Developer "visits" each defined connection on startup

    I am using SQL Developer 2.1.1.64. When I start it, it "visits" each defined connection. I'm using the term "visits" rather than "connects" because it doesn't auto-expand the entries in the Connections list, and it doesn't open up any SQL Worksheets. But it is DEFINITELY doing something which causes it to attempt to access each of the database servers (perhaps only to determine if a connection is possible).
    Is there any way to turn this off?
    The reason I ask: I have a number of connections pre-defined, for accessing customers' systems through a corporate VPN. Each time I access a customer system, the VPN prompts me to login and indicate a reason for access. I don't want to have to loop through all of those prompts every time I start SQL Developer.
    Some of my colleagues are using older versions (1.2, 1.5), and they don't have this issue.

    Hi kilsen,
    Laptop have 4 connections which are on local vm and 7 connections on local database.
    Local database not started, only started database on vm at 192.168.0.211.
    Data from wireshark after starting SQL Developer.
    No.   Time         Source            Destination          Protocol Info
    374 35.733516   Dell_ac:3b:49         Broadcast             ARP      Who has 192.168.0.4?  Tell 192.168.0.199
    375 36.233705   Dell_ac:3b:49         Broadcast             ARP      Who has 192.168.0.34?  Tell 192.168.0.199
    376 36.272571   Dell_ac:3b:49         Broadcast             ARP      Who has 192.168.0.2?  Tell 192.168.0.199
    377 37.233707   Dell_ac:3b:49         Broadcast             ARP      Who has 192.168.0.34?  Tell 192.168.0.199
    378 37.233756   Dell_ac:3b:49         Broadcast             ARP      Who has 192.168.0.2?  Tell 192.168.0.199
    379 37.387648   Dell_ac:3b:49         Broadcast             ARP      Who has 192.168.0.211?  Tell 192.168.0.199
    380 37.387816   Vmware_ac:de:2e       Dell_ac:3b:49         ARP      192.168.0.211 is at 00:0c:29:ac:de:2eIt's broadcasting every 10 to 30 seconds looking for my local vm destinations where IP addresses are 192.168.0.2 , 4, 34 and 211.
    When i login to vm 211 connection, data from wireshark:
    384 37.388488   192.168.0.199         192.168.0.211         TNS      Request, Connect (1), ConnectFrom my limited observations, laptop only broadcast for local vm IP addresses and do not actually send request to connect.
    Indeed there is no visible side effects felt on my laptop.
    Because of my VPN, I get prompted each time an application initially accesses a remote server+
    which would mean that it indeed send request to connect for vpn connection.
    Unable to test as i have no vpn connection.
    Would be interesting if you can install wireshark and check it out.
    HTH
    Zack

  • SQL Developer user defined reports (appropriate utilization)

    I have used SQL developer on a limited basis but I have never created a user defined report. Can someone compare and contrast the
    types of user defined reports that can be created via SQL developer versus the types of user defined reports that can be created via
    a tool such as Crystal Reports or similar tool.

    Hi user7753875 -
    I agree with reidelme that it won't match the capabilities for fancy organisation/output of tools like Crystal Reports, but you can do interrelated parent/multiple child reports.
    Check out the Reports tab on the SQL Developer Exchange for some examples of what other users have done with this.
    Brian Jeffries
    SQL Developer Team
    Edited by: bjeffrie on Jun 3, 2011 5:01 PM
    Turns out no one has used that in a long time. You will have to do some interpretive cut/past from xml given by web site & report editor in SQL Developer. Here is the "Who" report (master+2 child reports) from the exchange in a format you can use the import function from "User Defined Reports" on.
    <?xml version="1.0" encoding="UTF-8" ?>
    <displays>
    <display id="57507b3a-0130-1000-8008-a9fec67b8254" type="" style="table" enable="true">
         <name><![CDATA[Who]]></name>
         <description><![CDATA[
    A Report to show active seesion and some details about there activities. Includes 2 Child-reports for Active SQL and PID for the process supporting the session.
    ]]></description>
         <tooltip><![CDATA[Who is logged in and what is he doing]]></tooltip>
         <drillclass><![CDATA[null]]></drillclass>
         <CustomValues>
         </CustomValues>
         <query>
              <sql><![CDATA[SELECT sid, serial#, username, status, server, machine, program FROM v$session order by sid]]></sql>
         </query>
         <display id="null" type="Child" style="Table" enable="true">
              <name><![CDATA[ActiveSQL]]></name>
              <description><![CDATA[]]></description>
              <tooltip><![CDATA[]]></tooltip>
              <drillclass><![CDATA[null]]></drillclass>
              <CustomValues>
                   <TYPE>null</TYPE>
              </CustomValues>
              <query>
                   <sql><![CDATA[select c.spid b1, b.osuser c1, b.username c2, b.sid b2, b.serial# b3, a.sql_text,b.status,to_char(b.logon_time, 'DD-MON-YYYY HH24:MI:SS') from v$sqltext a, v$session b, v$process c where a.address = b.sql_address and b.paddr = c.addr and a.hash_value = b.sql_hash_value and b.sid = :SID order by c.spid,a.hash_value,a.piece]]></sql>
                   <binds>
                        <bind id="SID">
                             <prompt><![CDATA[SID]]></prompt>
                             <tooltip><![CDATA[SID]]></tooltip>
                             <value><![CDATA[NULL_VALUE]]></value>
                        </bind>
                   </binds>
              </query>
         </display>
         <display id="null" type="Child" style="Table" enable="true">
              <name><![CDATA[Process]]></name>
              <description><![CDATA[]]></description>
              <tooltip><![CDATA[]]></tooltip>
              <drillclass><![CDATA[null]]></drillclass>
              <CustomValues>
                   <TYPE>null</TYPE>
              </CustomValues>
              <query>
                   <sql><![CDATA[select p.spid,p.addr,s.sid,s.server,p.username,s.osuser,p.program,t.value/1024/1024 PGA_Mb from v$process p,v$session s,v$sesstat t where p.addr=s.paddr and s.sid=t.sid and s.sid = :SID and t.statistic#=20]]></sql>
                   <binds>
                        <bind id="SID">
                             <prompt><![CDATA[SID]]></prompt>
                             <tooltip><![CDATA[SID]]></tooltip>
                             <value><![CDATA[NULL_VALUE]]></value>
                        </bind>
                   </binds>
              </query>
         </display>
    </display>
    </displays>
    Edited by: bjeffrie on Jun 3, 2011 5:01 PM

  • Logging/viewing SQL statements generated by the SQL Developer IDE?

    I know it is possible to view the SQL statements that the SQL Developer IDE generates to fetch result-sets from the database whenever one performs any action - say expanding the "Tables" node for a database, for example. I would appreciate if someone could point out how this functionality could be enabled.
    Thanks,
    RG

    In 1.0, you could use the AddVMOption -Daudit.trace=db_api option inside the sqldeveloper.conf file.
    In 1.1 however, I don't get output inside the console anymore (for expanding trees, etc.).
    Kris, has this option been replaced by another one? Please let us in on all the fun ;-)
    K.

  • SQL Developer 3.1.07 SDO_GEOMETRY export insert statements bug

    Export table data with SDO_GEOMETRY column as insert statments not working properly.
    Generated script:
    +...+
    +Insert into EXPORT_TABLE (ID,GEOMETRY) values ('1',[MDSYS.SDO_GEOMETRY]);+
    +Insert into EXPORT_TABLE (ID,GEOMETRY) values ('2',[MDSYS.SDO_GEOMETRY]);+
    +Insert into EXPORT_TABLE (ID,GEOMETRY) values ('3',[MDSYS.SDO_GEOMETRY]);+
    +...+

    As noted by Brian Jeffries (as in, "Will be available in next release") in these two other threads:
    Re: Problem with displaying sdo_geometry objects
    Re: SQL Developer 3.0.04 - SDO_GEOM Issues
    -Gary

Maybe you are looking for