Copying SQL Script from Oracle SQL Developer into Excel with formatting

I need to copy a SQL Script into Excel in order to develop some VBA code. Is there any nice way that I can copy SQL Script from Oracle SQL Developer into Excel and retain its formatting? I am a stickler for having legible, readable SQL and like to have all my columns lined up and aliases lined up. When we used to use SQL Navigator, the tab formatting seemed to copy and paste just fine. Now that we have migrated to Oracle SQL Developer, the formatting seems to get all messed up.
And suggestions are greatly appreciated and Thanks in advance for your review and am hopeful for an answer.
Thanks.
PSULionRP

I suppose you want a real tabulator instead of spaces. You can configure this in the preferences (SQL Formatter - Oracle). You have to apply it then to your existing code (e.g. CTRL-F7), but new code should get it right from the start.
Hope that helps,
K.

Similar Messages

  • Error -While create a connection to Microsoft SQL Sever from Oracle SQL Dev

    Dear All,
    While I am trying to create a connection to Microsoft SQL Sever from Oracle SQL Developer. The following error: "Cannot connect to Microsoft SQL Server on localhost" has been occurred.
    Can anyone please guide me to solve this..
    Thanks in advance,
    Rider

    Hi,
    Issue not supported in sharepoint on-premise team.
    In addition, as this issue is related to Powerview, I suggest you create a new thread on for Powerview forum, more experts will assist you.
    https://social.technet.microsoft.com/Forums/en-US/home?forum=powerview
    Best Regards,
    Lisa Chen
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Running sql script from pl/sql

    Is there any standard way to run an external sql script from pl/sql
    I really appreciate any assistance.

    If you want, I did start writing a function reading and executing statements out of sql script with utl_file.
    can I issue this command in PL/SQL: EXECUTE IMMEDIATE '@filename.sql';
    the function could be extended for DDL, session setting, etc...
    Regards
    Laurent

  • Calling sql script from pl/sql block

    Hi
    I want to call a sql script from pl/sql block.
    like
    CREATE OR REPLACE procedure DataBaseExport(user_name in varchar2, pwd in varchar2)
    as
    begin
    execute immediate  '@ C:\Documents and Settings\umesh\emp.sql';
    end DataBaseExport;
    /

    Try something like this -
    CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "Host" AS
    import java.io.*;
    public class Host
         public static void executeCommand(String command)
         try {
                String[] finalCommand;
                   if (isWindows())
                        finalCommand = new String[4];
                        // Use the appropriate path for your windows version.
                        finalCommand[0] = "C:\\windows\\system32\\cmd.exe"; // Windows XP/2003
                        //finalCommand[0] = "C:\\winnt\\system32\\cmd.exe"; // Windows NT/2000
                        finalCommand[1] = "/y";
                        finalCommand[2] = "/c";
                        finalCommand[3] = command;
                   else
                        finalCommand = new String[3];
                        finalCommand[0] = "/bin/sh";
                        finalCommand[1] = "-c";
                        finalCommand[2] = command;
              final Process pr = Runtime.getRuntime().exec(finalCommand);
             pr.waitFor();
             new Thread(new Runnable()
                public void run()
                      BufferedReader br_in = null;
                   try
                        br_in = new BufferedReader(new InputStreamReader(pr.getInputStream()));
                        String buff = null;
                        while ((buff = br_in.readLine()) != null)
                                  System.out.println("Process out :" + buff);
                               try {Thread.sleep(100); } catch(Exception e) {}
                        br_in.close();
                   catch (IOException ioe)
                        System.out.println("Exception caught printing process output.");
                        ioe.printStackTrace();
                 finally
                     try {
                              br_in.close();
                          } catch (Exception ex) {}
         ).start();
         new Thread(new Runnable()
           public void run()
                BufferedReader br_err = null;
                try
                   br_err = new BufferedReader(new InputStreamReader(pr.getErrorStream()));
                   String buff = null;
                   while ((buff = br_err.readLine()) != null)
                        System.out.println("Process err :" + buff);
                        try
                           Thread.sleep(100);
                         } catch(Exception e) {}
                   br_err.close();
               catch (IOException ioe)
                   System.out.println("Exception caught printing process error.");
                   ioe.printStackTrace();
              finally
                  try
                          br_err.close();
                   catch (Exception ex) {}
          ).start();
         catch (Exception ex)
                  System.out.println(ex.getLocalizedMessage());
      public static boolean isWindows()
              if (System.getProperty("os.name").toLowerCase().indexOf("windows") != -1)
              return true;
              else
              return false;
    CREATE OR REPLACE PROCEDURE Host_Command (p_command IN VARCHAR2)
    AS LANGUAGE JAVA
    NAME 'Host.executeCommand (java.lang.String)';
    --- THE PERMISSIONS ---
    call dbms_java.grant_permission('SYSTEM', 'SYS:java.io.FilePermission', '<<ALL FILES>>', 'read ,write, execute, delete');
    call dbms_java.grant_permission('SYSTEM', 'SYS:java.lang.RuntimePermission', 'writeFileDescriptor', '');
    call dbms_java.grant_permission('SYSTEM', 'SYS:java.lang.RuntimePermission', 'readFileDescriptor', '');And, finally,
    create or replace procedure call_sql_file(usr  in varchar2,
                                              pwd  in varchar2,
                                              host_str in varchar2)
    is
    begin
       host('sqlplus -s usr/pwd@host_str C:\UAX_Auto_Count.sql');
    exception
      when others then
        dbms_output.put_line(sqlerrm);
    end;Now, you can pass all the argument in order to execute that file.
    N.B.: Not Tested...
    Regards.
    Satyaki De.

  • How to call SQL script from PL/SQL block

    Hi All,
    I have a pl/sql block from which i need to call a *.sql script file.
    Please tell me that how can i do this?
    Thanks and Regards.

    > Though just for knowledge sake, would you please tell if there is a way
    to call a sql script from a pl/sql block.
    This question stems usually from a confusion about client-server and which is which in Oracle.
    SQL*Plus is a client. PL/SQL is a server side language. SQL is a server side language.
    When entering either one of these two languages in SQL*Plus (or TOAD, SQL-Developer, etc), the content is shipped to an Oracle server process, is parsed there, and is executed there.
    The Oracle server process servicing the client can accept a single SQL statement or PL/SQL block at a time.
    It cannot accept a block of SQL statements delimited with a semicolon. That is a client concept where the client will read each delimited statement and send that, one after the other (in synchronous call mode) to the Oracle server for execution.
    The Oracle server does not have a "script parser". It understands SQL. It understands PL/SQL. And that is what it expects from the client.
    Whether the client supports the SET command, the HOST command, SPOOL command, ability to run scripts, and so... have no bearing on what the server itself is capable of doing. The server does not care what feature set the client has. It is tasked with servicing the client via SQL and PL/SQL.
    It is not tasked to support or emulate client features like running SQL scripts.
    Nor confuse PL/SQL with the very limited command set of SQL*Plus. The two has nothing in common. And just as PL/SQL cannot understand C# or Delphi commands, it cannot understand SQL*Plus commands.

  • Calling a SQL script from the PL/SQL block.

    Hello All,
    I am using oracle 11g database.
    My requirment is as follows. I have a SQL script to alter the table. But before alter the table I need to test some condition , if the condition satisfy then I have to alter the table through the SQL script. For the checking the condition I have to use the plsql block and inside I need to call the SQL script.
    Can I call a SQL script from PL/SQL block, if yes then how?
    I am tring to use START, RUN and @ command but it is throughing error.
    Thanks
    SUN

    [PL/SQL manual|http://download.oracle.com/docs/cd/B10501_01/server.920/a96540/functions55a.htm#77600] Ctrl-F start, finds nothing. [SQLPlus manual|http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/toc.htm] Ctrl-F start finds this. Isn't it wonderful that Oracle documents this stuff so we don't have to guess.
    Can I call a SQL script from PL/SQL block, if yes then how? No.
    You could call the stored procedure in a SQL*Plus script before the alter table and have it raise an exception if the condition is not met and have the script quit when there is an error.

  • Copying from Oracle SQL Developer to Microsoft Word doesn't retain formatting (Font,colors etc)

    Copying from Oracle SQL Developer Worksheet doesn't retain formatting (font,color etc...)in Microsoft Word but copying from other programs such as
    visual studio, chrome browser etc works fine. This doesn't work even after changed the setting to Keep Source formatting of Options-> Copy and Paste Settings

    Hi,
    I notice that you have cross posted in Answers forum and Oracle forum. Have you tried Mr. Peter's suggestion?
    Then, I recommend we check the Word settings:
    1. Go to: Options > Advanced > Cut, Copy and Paste
    2.  Make sure that Use smart cut and paste is ticked. 
    3. Click the Settings button next to this option
    4. Make sure that Smart Style
    Behavior is checked.
    If the issue still exists, please upload a sample through One Drive, I want to test.
    Regards,
    George Zhao
    TechNet Community Support

  • Run sp from Oracle SQL Developer

    Hi,
    Anbody can help me to find why I cant' see output after running my simple sp lke below. When I ran create View from sql it's fine, I see <Statetement Output> window displayed, and see new View.
    Not the case when I do sp, I can compile it and get "compiled" status on Messages pane, not sure is't compiled sucessfully or not. But then pressing RUN green arrow, or right click - RUN nothing happenes, no new view, no any output.
    I defenetely has all rights to run sp as per our admin.
    Tx
    Trent
    create or replace
    PROCEDURE usp4 AS
    BEGIN
    execute immediate '
    CREATE OR REPLACE FORCE VIEW "USERMO"."V2c"
    AS
    SELECT "TDATE","AMOUNT","ESS" FROM TT_REG;';

    Tx, sb92075
    I see that you running it all from command line, right ?
    It's still different on my SQL Developer session, I don't have anything on messages pane and again I don't see output i.e. View created.
    Can anybody share opinions how to run this sp from Oracle SQL Developer? I expect to see newly created V2c View in my object list upon execution.
    create or replace
    PROCEDURE usp4 AS
    BEGIN
    execute immediate '
    CREATE OR REPLACE FORCE VIEW "USERMO"."V2c"
    AS
    SELECT "TDATE","AMOUNT","ESS" FROM TT_REG;';
    T
    Edited by: trento on May 4, 2010 1:29 PM

  • How to conect to the Oracle 10 g Exp Edition from Oracle SQL Developer Tool

    Hi all,
    i have installed Oracle 10 g Exp Edition in my stand alone system(no internet connected to the system).
    I want to connect through Oracle SQL Developer tool.
    Can any one please tell me the steps involved in "how to connect to the Oracle 10 g Exp Edition from Oracle SQL Developer Tool ".
    Thanks in Advance.

    Creating a Database Connection
    http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/sqldev/r30/sqldev3.0_GS/sqldev3.0_GS.htm

  • Favorites icon gone from Oracle SQL Developer Help screen

    Favorites icon gone from Oracle SQL Developer 3.0 Help Center screen
    How do I get it back?
    In Oracle SQL Developer 3.0 I clicked
    Help->Table of Contents
    to bring ut the Help Center window.
    It the Help Center window I used to have a Favorites tab next
    to the Contents TAB on the left side of the window.
    I did an unpin some how and now I can't get the Favorites
    TAB back.
    On the right side there is a Star + icon that does
    Add to Favorites.
    I can add links to favorites but I have no way to go to these
    saved favorites anymore.
    How do I get the Favorites TAB/Icon back?
    Thanks

    Hi John,
    SQL Developer depends on JDeveloper code for the Help. After closing the Favorites tab I see no way to re-open it in the UI, so I imagine there may be a bug on the JDev side. Fortunately, there is a manual fix:
    In file product-preferences.xml
    In directory C:\Documents and Settings\<userid>\Application Data\SQL Developer\system3.0.04.34\o.sqldeveloper.11.1.2.4.34
    use Notepad to look for the lines like:
          <value n="helpDynamicLinksNavigatorLocation" v="3"/>
          <value n="helpFavoritesNavigatorLocation" v="0"/>
    Just change the value "0" to "2"Regards,
    Gary
    SQL Developer Team

  • Error while inserting into MS-SQL Server from Oracle using HS

    Hi,
    I am using hetrogeneous connection.
    I want to insert into MS-SQL Server Table by selecting from Oracle Tables.
    insert into tableone@mssql select * from table2;
    Table2 is in oracle database.
    while executing i'm getting
    ORA-02025: all tables in the SQL statement must be at the remote database
    Please guide me.
    Regards
    Salih KM

    some guy come up a solution by himself before. go ahead and try it
    ORA-02025 error while insert into emp@custard select ....

  • Getting windows error during running the sql scripts from form 6i

    I made a little form application. The purpose of this application is to generate explain plan for a particular SQL. Some sql scripts run internally in order to populate the result on form’s screen after pressing the form’s button but I am getting windows error during running the sql scripts from form 6i.
    I am using forms 6i with patch 17 with Oracle 10G database on windows 2000 professional on same computer.
    This application runs fine with 8i.
    Please inform me where the problem is and how to overcome it.
    Zafri.

    I am using Text_IO in my form's when button press trigger , inorder to create the
    text file, then in the same when button press triger
    I am calling RMAN via host command in order to run the script which was created by text_IO.
    Below you find some of the code. I will appreciate if you solve the problem.
    when button press trigger:
    Declare
    in_file3 Text_IO.File_Type;
    linebuf3 VARCHAR2(1800);
    output11 varchar2(1000);
    BEGIN
         output11:='C:\EXPLAIN_PLUS\misc\rm_file.bat ';
    Host(output11,no_screen);
    :sql.execution_plan:= 'Working........................';
    synchronize;
    in_file3 := Text_IO.Fopen('c:\explain_plus\misc\create_table.txt', 'w');
    Text_IO.Put_Line(in_file3, linebuf3);
    Text_IO.put_line(in_file3,' ');
    Text_IO.put_line(in_file3,' run { sql "create table PLAN_TABLE (statement_id,...object_name varchar2(30),object_instance numeric,object_type varchar2(30),optimizer varchar2(255),search_columns number,id .....partition_start varchar2(255),partition_stop  varchar2(255),partition_id numeric,other long,distribution varchar2(30)) "; } ');
    Text_IO.put_line(in_file3,' ');
    Text_IO.put_line(in_file3,' ');
    Text_IO.FCLOSE(in_file3)
              Declare
    un VARCHAR2(80);
    pw VARCHAR2(80);
    cn VARCHAR2(80);
    output VARCHAR2(1000);
    output2 VARCHAR2(1000);
    dummy varchar2(40);
    in_file Text_IO.File_Type;
    linebuf VARCHAR2(1800);
    BEGIN
         Get_Connect_Info(un,pw,cn);
         /* for Plan_table Begg. Second INNER BLOCK */
         declare
              dummy2 varchar2(40);
         begin
         select table_name into dummy2 from all_tables where table_name='PLAN_TABLE';
         if dummy2 = 'PLAN_TABLE' then
         output2:='rman target/ nocatalog @C:\EXPLAIN_PLUS\MISC\TRUNC2.txt ' ;
    Host(output2,no_screen);
         end if;
         exception
         when no_data_found     then
    output2:='rman target/ nocatalog @C:\EXPLAIN_PLUS\misc\create_table.txt ';
    Host(output2,no_screen);
         end; --

  • PL/SQL migration from Oracle 7.3 to Oracle 8.1.6

    Hi,
    I am planning to upgrade from Oracle 7.3 to Oracle 8.1.6. As well from HP-UX 10.20 to HP-UX 11.0.
    I do not want to run my PL/SQL code in compatibility mode.
    Please suggest migration path.
    Also, i want to migrate PL/SQL scripts from 8.0.5 to 8.1.6 on HP-UX 11.0. I know this should be
    straight forward migration.
    Does the recompilation on HP-UX 11.0 with 8.1.6 environment works fine..?!
    I read about the 'utlrp.sql' script to be run to find out the report prior to recompilation on target
    platform. If i do this, it should enough OR is there any other ways of doing things..?!
    Please post your feedback.
    Thanks,
    vinod

    Hi,
    I have never done the migration from 7.3 to 9i. But I had done 8.0 to 8i and 8i to 9i.
    Pl/SQL code should work fine as it is. I wonder what will happen if you have any variables declared VARCHAR (not VARCHAR2) ? There can be few places like that, if the application was originally written on Oracle 6.Otherwise, the code should work as it is.
    Regarding Pro*C, you need to use the new make file which has come with 9i.
    Also, I do not remember exactly, but probably, you need to initialize all VARCHAR veriables declared between BEGIN DECLARE SECTION and END DECLARE SECTION. Initialize all of them with \0 (NULL charactor).
    I think that should be enough for 7.x application to run on 9i.
    Regards

  • Execute sql script in oracle server

    hi how can i run an SQL script in oracle server in every first day of the month? i dont want to run that script manually every first day of the month.

    What OS and version are you running?
    You can schedule this from the OS side as well if you don't want to use the scheduler.
    In linux you can make use of the crontab:
    crontab -e
    #then paste the following lines with the path to your scripts
    #.---------------- minute (0 - 59)
    #|   .------------- hour (0 - 23)
    #|   |   .---------- day of month (1 - 31)
    #|   |   |   .------- month (1 - 12) OR jan,feb,mar,apr ...
    #|   |   |   |  .----- day of week (0 - 7) (Sunday=0 or 7)  OR sun,mon,tue,wed,thu,fri,sat
    #|   |   |   |  |
    #*   *   *   *  *  command to be executed
    00 01 1 * * /<path to your scripts>/script_name.shThe above script will run on the 1st day of every month at 01h00.
    your script (the one you are calling in the cron) will have to call the sql script and should look similar to this:
    #export all your environment variables here
    # for example
    export ORACLE_BASE=/u01/app/oracle
    export ORACLE_HOME=$ORACLE_BASE/product/<your path>
    export ORACLE_SID=ORCL
    export PATH=$ORACLE_HOME/bin:$PATH
    sqlplus user/password@DB @/path/your_sql_script.sqlHope this helps

  • Calling sql script from shell script

    Hi,
    I know this question has been asked many time in various forums, but I tried many combinations and not able to figure out what I'm missing.
    Basically - I'm trying to call a sql script from a shell script.
    This is my sql script (plsql.sql) -
    DELCARE
    v_empno NUMBER := '&empno';
    BEGIN
    select ename,sal from emp where empno = v_empno;
    dbms_output.put_line('Inside the plsql file');
    END;
    This is my unix shell script - I'm caling the plsql.sql file with the parameter passed(97882). I don't get any output. at least I should be able to view the dbms output if not for the sql query inside the sql script.
    #!/usr/bin/ksh
    sqlplus -s sam/olo01 << HERE
    @plsql.sql 97882;
    HERE
    What is it I am missing ?

    Using your scripts (and having to create and populate a table myself, that would have what your select statement implies),
    oracle:oklacity$ cat plsql.sql
    DELCARE
    v_empno NUMBER := '&empno';
    BEGIN
    select ename,sal from emp where empno = v_empno;
    dbms_output.put_line('Inside the plsql file');
    END;
    oracle:oklacity$ cat doit.sh
    #!/usr/bin/ksh
    sqlplus -s sam/olo01 << HERE
    @plsql.sql 97882;
    HERE
    oracle:oklacity$ ./doit.sh
    SP2-0042: unknown command "DELCARE" - rest of line ignored.
    SP2-0734: unknown command beginning "v_empno NU..." - rest of line ignored.
    oracle:oklacity$
    This is the kind of information you should have put in your opening post.

Maybe you are looking for

  • Problem with report generation toolkit

    I am using labview 2011. When I right clicked on block diagram I can see reprt generation toolkit. But when I am trying to use it to save a word file I faced a error code-41007.Please help me.......... Thank you in advance........

  • Business area not appearing in Accounting document of 543's materail doc

    Hello , We have created new plant CN06 (and assigend to Company code CN06) by copying existing plant CN03 (assigned to Company code CN03). Business area CN06 was defined and assigned to plant CN06 and valuation area. When we do normal GR document bus

  • Function Module to update Serial Numbers in Delivery

    Hello there, I am attempting to update serial numbers in an outbound delivery using function module SERNR_ADD_TO_LS followed by a perform of serial_liste_post_ls IN PROGRAM saplipw1. However I am struggle with error messages of inconsistancies in sta

  • Programmatic User Authentication in JHS 10.1.2

    Hi, I've been trying to use JHS 10.1.2. and the Programmatic User Authentication example of 9.0.5.2 but this obviously does not seem to work. Could you please supply information how to enable programmatic User Authentication in JSH 10.1.2? Thanks Wil

  • 2012 MacBook Air won't show on my projector

    I have been using the same exact setup with the 2011 MBA but the new one won't work with my projector.  I have a Acer X1161P 3D-DLP Projector and the proper cables since this has previously been working.  Is this a known issue?  I saw that in the fir