Difference between ';' and '/' in the SQL scripts

Hi All,
Could anyone please let me know the difference between placing ';' and '/' in the sql scripts.
I am placing couple of insert statements in a textfile with .sql extension and running it from the sql prompt.
Which one( ';' or '/') should be keep at the end of each statement in the script.
SQL> SELECT SYSDATE FROM DUAL;
SYSDATE
12-MAY-13
SQL> SELECT SYSDATE FROM DUAL
  2  /
SYSDATE
12-MAY-13Thanks,

968217 wrote:
My doubt is how it understands or the difference b/w the below two view statements one with ';' and another one with '/'. Sorry if i am unclear.They are identical in SQL*Plus. These characters mean "+send entered/buffered text to Oracle to parse and execute+".
So - SQL*Plus sends "+create or replace view ev1 as select ename , sal from emp+" to the server (via a cursor execute):
create or replace view ev1 as select ename , sal from emp
/And again, SQL*Plus sends "+create or replace view ev1 as select ename , sal from emp+" to the server (via a cursor execute):
create or replace view ev2 as select ename , sal from emp;These are identical statements.
As I mentioned in the post I referred you to. Oracle also uses the ";" character in the PL/SQL language. So when you enter PL/SQL code in SQL*Plus, you do not want SQL*Plus to send each line of PL/SQL code to the server. Instead, you want it to wait till the last statement has been entered and then send the the whole block to the server to be parsed and executed,
SQL*Plus has a basic parser itself. It uses that to figure out what you have entered, and whether a ";" you enter is an instruction from you to it, to send the text to the server - or when you enter a ";", it is part of the text for the server and that it should not react to it.
Thus when you enter the following, SQL*Plus recognises that you are using the SQL language, and as this language does not use ";" characters, a ";" character when entered means that it needs to send the text to the server to be parsed and executed:
SQL> select * from emp;
// ; character instructs SQL*Plus to create and execute cursor "select * from emp"When you enter PL/SQL code, SQL*Pus recognises that and knows that ";" characters entered indicates end-of-statement for PL//SQL and that it should not act on that,
SQL> begin
  2    null;
  3  end;
  4  /
// SQL*Plus ignores the ";" character - and the "/" character is used to
// instruct SQL*Plus to create and execute cursor"begin<LF>null;><LF>end;"

Similar Messages

  • To automate the SQL scripts using PLSQL Code

    Hi All,
    I have 20 database server (11.2.0.3) hosted on  unix and Windows platforms.
    Every day I have to kill inactive sessions from all the these 20 database servers. So I have made a below script::
    connect sys/&&sys_password@&&tns_database_name as sysdba
    SPOOL E:\DELETE_INACTIVE_SESSIONS.SQL
    set PAGESIZE 1000
    set LIN 5000
    SET ECHO OFF;
    SET FEEDBACK OFF;
    SET HEADING OFF;
    select 'alter system kill session '||'`'||SID||','||SERIAL#||'`'||' immediate;'  from v$session where status='INACTIVE' and username in ('OSS_DICTIONARY','ADMINISTRATOR');
    SPOOL OFF;
    @@E:\DELETE_INACTIVE_SESSIONS.SQL
    Is there any way so that this execution of script can be automated in PLSQL code for 20 servers so and that code could be put in batch file for execution(i.e. can be execute through batch file from my windows laptop).
    Thanks

    Shrma wrote:
    Is there no way to handle the sql scripts in PLSQL code?
    Well, remember that PL/SQL is executed on a specific server by a certain user so you are already connected when executing a PL/SQL code.
    You could actually use a SQL Plus script to connect to different servers using connect and run your script.
    i.e.:
    SQL> connect sys/pwd_server1@db_server1
    SQL> @killinactive.sql
    SQL> connect sys/pwd_server2@db_server2
    SQL> @killinactive.sql
    But it does not make so much difference with my previous solution.
    Please explain exactly what you would like to do.
    Regards.
    Al

  • Difference between " " and ' ' in oracle

    Hi
    What is the difference between " " and ' ' in oracle

    Generally, single quotes ' are used as string delimiters. Double quotes are NOT string delimters in SQL, but are used to preserve the precise representation of what's enclosed - for instance, "abc" would be recognized as lowercase in situations where SQL would automatically translate them into upper case. Thus, something like
    SQL> select dummy as "dummy"
      2    from dual;
    d
    Xmeans to select the dummy column but preserve the name in lower case where normally the 'd' in the column name (cut off) would be 'D'
    Using empty strings to represtent nulls has already been discussed on this thread. Remember that spaces are NOT nulls. I personally find the replace-null-with-space method a bit clunky, but a lot of mainframe-to-oracle conversions use it.

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

  • Difference between and != operators

    Hi All,
    My question may be very basic to you all
    Please let me know the difference between <> and != operators
    Thanks in advance

    user609996 wrote:
    Sorry to all,
    the operator "<>" is not printed
    I want the difference between "<>" and "!=" operators.And as you've already been told there is no difference between the &lt;&gt; and != operators. They mean the same thing, but are just different representations of it.
    The only difference is that the Oracle forum can't display &lt;&gt; if it is just typed in normally. To show it we have to type &lt and &gt with a ";" after each.

  • Difference between & and && operater   and  difference between and

    what is difference between & and && oprater in java
    and what is difference between << and <<< operater

    i am sorry i dont know about << ,<<<< There isn't a <<< operator.
    However I presume the operator being referred to is >>>
    They are bit shifting operators.
    In fact its the [url http://java.sun.com/docs/books/tutorial/java/nutsandbolts/bitwise.html]very next page of the tutorial linked to above.
    << == left shift
    == right shift,
    == right shift (unsigned)
    Cheers,
    evnafets

  • How to install and configure the SQL Server

    Hi All,
    We have to install SQL server in the new server because the old server is crash and need to upgrade. Please advice How to install and configure the SQL Server to run SAP Business One 8.8 successfully and what part we do have to give attention.
    Kind Rgds,
    Steve

    Hi,
    Try this solution:
    The step-by-step installation guide can be found in the documentation included in the installation media. (\Documentation\SystemSetup\AdministratorGuide_SQL.pdf).
    Below are some important parts that you should pay attention to during the Installation process.
    Resolution
    Collation setting: It must be set as SQL_Latin1_General_CP1_CI_AS,even the company DB is non-english location. The company DB will be created as corresponding collation settings automatically.
    Instance and TCP Port : It is recommended to run SBO on default instance and TCP port 1433. Otherwise,some optional components such as B1i may not work properly.
    Native Client: SQL Server Native Client should be installed on every client machine to enable the ODBC connection to DB server.
    Rgds,

  • How to run the SQL Script in SQL Prompt?

    Hi ExpertGroup,
    I have written one SQL Script name called "MySQLSCript.SQL". I want to know how to run the SQL Script in SQL Prompt?.
    Generally, I run SQL Script in PL/SQL Developer tool. But In this case, some SET command is not working/supporting in PL/SQL Developer Tool.
    Let me know, How to Run in SQl Prompt.
    Thanks & Regards,
    Senthil K Kumar.

    This is my SQL Script....
    SET COLSEP '|'
    SET LINESIZE 32767
    SET PAGESIZE 50000
    /* SET LINESIZE 3000
    SET PAGESIZE 50000
    SET DEFINE OFF */
    SET ECHO OFF
    SET FEEDBACK OFF
    --SET HEADING OFF
    SET TRIMSPOOL ON
    SET NEWPAGE NONE
    SET UNDERLINE OFF
    SPOOL &&EnterPath;
    SELECT * FROM &&TableName;
    SPOOL OFF
    SET FEEDBACK ON
    --SET DEFINE ON
    PROMPT Done.
    I am able to run this script in SQL Prompt....
    Its executing fine...
    But, If I am executing again it maynot asking for new set of data....
    alternativily its taking old values only.....
    how can i exeute with new set of data in the sql prompt.....

  • Please add exit to the last line of the sql script

    Hi,
    I am executing a sql script from UNIX shell. When I execute it at the command prompt the script executes successfully, but when I schedule the script on cron, the script is throwing an error with the above message
    "Please add exit to the last line of the sql script"
    Any idea what is happening? Thanks in advance for any help
    thedba

    It works check this out..
    << script a.sh >>
    logfile=/home/oracle/sri/x.log
    sqlplus -s /nolog <<DOC >> ${logfile}
    whenever sqlerror exit sql.sqlcode
    connect scott/tiger
    @a.sql a.log
    DOC
    <<  script a.sql >>
    set feedback off
    set echo off
    spool &1
    select * from tab where tname like 'A%';
    spool off
    exit;
    << a.log >>
    TNAME                          TABTYPE  CLUSTERID                              
    AQ$DEF$_AQCALL                 VIEW                                            
    AQ$DEF$_AQERROR                VIEW                                            
    AQ$_DEF$_AQCALL_F              VIEW                                            
    AQ$_DEF$_AQERROR_F             VIEW                                            
    AQ$_INTERNET_AGENTS            TABLE                                           
    AQ$_INTERNET_AGENT_PRIVS       TABLE                                           
    AQ$_QUEUES                     TABLE                                           
    AQ$_QUEUE_TABLES               TABLE                                           
    AQ$_SCHEDULES                  TABLE                                           
    << x.log >>
    TNAME                          TABTYPE  CLUSTERID
    AQ$DEF$_AQCALL                 VIEW
    AQ$DEF$_AQERROR                VIEW
    AQ$_DEF$_AQCALL_F              VIEW
    AQ$_DEF$_AQERROR_F             VIEW
    AQ$_INTERNET_AGENTS            TABLE
    AQ$_INTERNET_AGENT_PRIVS       TABLE
    AQ$_QUEUES                     TABLE
    AQ$_QUEUE_TABLES               TABLE
    AQ$_SCHEDULES                  TABLE-Sri

  • Whats the difference between and Album and a Smart Album

    OK, just upgraded.... So, whats the difference between an Album and a Smart Album?  
    Also, I like to organise my stuff, so if I create a folder for each year, and then a project within that year, why is it that the photos are always in both - and then again if I chose to create an album specific to a project, they are there again.
    So it might look:
              Folder (2012 Equine Photography)
                   Project - Specific Events
                        Album - Big Barn Dressage May
    Does this mean the individual photo is stored 3 times and using 3 times the space?
    Thanks guys!

    Mrsthebraggster wrote:
    So it might look:
              Folder (2012 Equine Photography)
                   Project - Specific Events
                        Album - Big Barn Dressage May
    Does this mean the individual photo is stored 3 times and using 3 times the space?
    No. Conceptually the Master only lives lives in the single (time based) Project you import it into. Albums are just collections of pointers that point to  images in various Projects.
    "Big Barn Dressage May" could be a Project, but only if it is only one day and a limited number of image files; otherwise an Album. "2012 Equine Photography" should be an album or a Folder of Albums. "Specific Events" could be an Album or a Folder of Albums.
    A Project should not be used as a Folder.
    From an earlier post of mine:
    Folders are indeed flexible organizational tools but IMO often overused. Folders can effectively hide contents from view and therefore require users to remember how folders are nested and what is inside them. Folders were the only way to deal with single-original film, but are IMO limiting to image database thinking.
    The way I look at it conceptually:
    Aperture is a database (DB), and each image file lives in one Project.
    Albums are just collections of Pointers that point to individual image files living in one or more Projects. Since they just contain pointers, albums can be created or deleted at will without affecting image files. Very powerful. And Albums of pointers take up almost zero space, so they are fast and do not make the Library size grow.
    Keywords can be applied to every image separately or in batches. Keywords are hugely powerful and largely obviate the need for folders. Not that we should never use folders, just that we should use folders only when useful organizationally - - after first determining that using keywords and albums is not a better approach.
    As one example imagine the keyword "flowers."  Every image of a 100,000 images Library that has some flowers in it has the keyword flowers. Then say we want to put flowers in an ad, or as background for a show of some kind, or to print pix for a party, or even just to look for an image for some other reason. We can find every flower image in a 100k-image database in 2 seconds, and in another few seconds create an Album called "Flowers" that points to all of those individual images.
    Similarly all family pix can have a keyword "family" and all work pix can have a key word "work." Each individual pic may have any number of keywords. Such pic characteristics (work, family, flowers, etc.) should not be organized via folders.
    So by using keywords and albums we can have instant access to every image everywhere, very cool. And keywords and albums essentially take up no space in the database.
    Another approach is to use a folder "Family" for family pix, a folder "Flowers" for flowers pix and another folder "Work" for work pix. IMO such folders usage is a very poor approach to using an images database (probably stemming from old paper or film work practices). Note that one cannot put an image with family in a field of flowers at a work picnic in all three folders; but it is instant with keywords.
    HTH
    -Allen

  • Difference between processes in the page rendering and in page processing ?

    db11gxe and apex 4.0 ,
    hi all ,
    i am confused about the difference of the processes in these two columns , what is the diff ?
    the same "Select the category of the process you wish to create:"? there is no difference i can see ?
    so what is the diff again ?
    thanks

    Newbi_egy
    Yes. There are process types that are specific for the page processing or page submit phase and not the page rendering phase.
    Just as there are process type that are specific for page rendering and not for page submit.
    And there is even a process type that is specific for the user interaction phase. Namely the "Run On Demand Process"
    But I don't understand what there is to exclaim about
    1. to cry out or speak suddenly and vehemently, as in surprise, strong emotion, or protest.
    2. to cry out; say loudly or vehemently.
    (The American Heritage® Dictionary of the English Language, Fourth Edition copyright ©2000 by Houghton Mifflin Company. Updated in 2009. Published by Houghton Mifflin Company. All rights reserved.)
    I understand that it can be confusing at first. That you get the same wizard and the same options for process types no matter which process point you have chosen. But if you start building your pages using the wizard to create forms and reports. The process needed for those regions to work are automatically created. Showing you what the correct display point is for them.
    Nicolette

  • Problem while executing script in Toad - How to use '&' in the sql script ?

    I have to execute sql script in toad. Sql script has one insert query in which one insert-value is 'USA & CAN'. When I executed the script in toad by pressing F5, I got a prompt window asking for the value if 'CAN' as it is after the &.
    I tried using[b] {escape '\' } .... but could not resolve the problem.
    Is there any solution or workaround to overcome this problem. I have thousands of records with such values and I have to use sql script only.

    There is an option in TOAD to change this behaviour.
    Look in VIEW/OPTIONS/SQL Editor/
    Uncheck the box for "Scan statements for bound variables before execution".
    In SQL*PLUS it would be SET SCAN OFF
    (desupported version is SET DEFINE OFF)
    Message was edited by:
    Sven Weller

  • Command for exceuting the sql script to a db from linux home

    Hi All,
    Can someone please tell me how to execute the /addev/ad/11.5/sql/adcdexcp.sql against case122 from my linux home for our product.
    Thanks in Advance

    Do not fully understand your question.. but some basics:
    You need an Oracle OCI client driver and Oracle client on the client side. E.g. Oracle Instant Client and Oracle's SQL*Plus.
    You need to connect to the database server (using SQL*Plus as the example):
    sqlplus scott/tiger@db-alias
    Where db-alias is a TNS alias for the database.
    Once connected, you can use SQL*Plus to load the contents of a SQL script, and send a single SQL command (or PL/SQL anonymous block) at a time to the Oracle server for execution. E.g.
    SQL> @/addev/ad/11.5/sql/adcdexcp.sql
    I suggest you point your browser to http://tahiti.oracle.com (Oracle Documentation Portal), and look for the SQ*Plus User Guide for the Oracle version you're running.
    If you can be more specific and provide proper details as to what you are attempting to achieve, forum members will be a better position to provide assistance and advice.

  • Difference between and lock and eneque in oracle

    Please give the difference between a lock and eneque in oracle
    Naveen

    Here is what Oracle defines an Enqueue to be in the 9.2 Glossary >>
    enqueue
    Shared memory structures that serialize access to database resources. Enqueues are local to one instance if Real Application Clusters is not enabled. When you enable Real Application Clusters, enqueues can be local or global to a database. (See also: latch, lock, and resource.)
    <<
    There is also a type of enqueue associated with Advanced Queueing. Similar concept but different specialized purpose.
    Generally speaking Locks on the other hand serialize access to row data. Oracle actually records row locks in the data blocks.
    Enqueues, Locks, and Latches are perform the same basic function: serialize access but the methods are implemented differently and applied to different functional areas of the rdbms.
    HTH -- Mark D Powell --

  • Please tell basic difference between "" and null  for String  variable.

    1.What is difference between String strRemitInfo = "" and String strRemitInfo = null?
    2. Which one is good practice while coding ?

    1.What is difference between String strRemitInfo = ""
    and String strRemitInfo = null?Emptry string and nul reference
    >
    2. Which one is good practice while coding ?Depends on what you want to do.

Maybe you are looking for

  • Won't show ink status levels

    I have an HP Officejet 6310xi All-in-One that I've had for quite a while. I used to be able to bring up the ink level status but not anymore. I had a bluetooth connection and thought that was the problem. But I switched to a USB cable to be able to c

  • Sound file path

    Hi Everyone, I'm using the sound file path to  play with Play Sounf File.vi. I have to select the file again everytime I close and open labview. Any suggestion as to how I can make it permanent? Thanks. Solved! Go to Solution.

  • Record TV through Powerbook - Can it be done?

    Hi all, I just got a new flash plasma TV with all the bells and whistles and wanna record some of the digital TV. I've looked at the Apple TV component, but the specs and functions didn't really impress me for the price. I also looked at a Playstatio

  • 'RSTS_READ' after upgrade error Required conversion not possible (ZFORM16)

    Hi, We have recently upgraded from SAP 4.7 to SAP ECC 6.0. For client requirements, they have developed ZFORM16 in 2006 by copying the standard form HINCF160. But after upgradation, when we execute ZFORM16  for 2006 data we are getting the error mess

  • MM inventory report

    We need an inventory summary report for each month end whereby i should contain data like material, plant,storage location, batch,quantity,commodity code, standard cost, info record cost.If we prepare  a query kindly inform the tables where we can jo