SQL * Plus - forward slash usage

I have package spec and body in separate files, i have 2 packages, so i have 4 files in total.
I want to install the 2 packages using "SQL * Plus", but how the install-script should look like. I don't understand how and where to use "sql * plus" command "forward-slash" "/".
Should it be like this:
spec_file_1
body_file_1
spec_file_1
body_file_1
Or how the "/" should be used? Only ones at the end? I don't understand.

You can write a single file this way:
create or replace package a is
end;
create or replace package body a is
end;
create or replace package b is
end;
create or replace package body b is
end;
/And then run it in sqlplus this way:
SQL >@a.sqlor multiple files this way:
create or replace package a is
end;
create or replace package body a is
end;
create or replace package b is
end;
create or replace package body b is
end;
/And then run them in sqlplus this way:
SQL >@a.sql
SQL >@b.sql
SQL >@c.sql
SQL >@d.sqlOr write a file e that runs a,b,c,d this way:
@a.sql
@b.sql
@c.sql
@d.sqlAnd then run it in sqlplus this way:
SQL >@e.sqlIn the previous examples the slash is always at the end of each CREATE...END;
This is not compulsory. In the last example you could remove the slashes from the files a,b,c,d and write the file e this way:
@a.sql
@b.sql
@c.sql
@d.sql
/This works anyway.
Max
[My Italian Oracle blog|http://oracleitalia.wordpress.com/2010/01/23/la-forza-del-foglio-di-calcolo-in-una-query-la-clausola-model/]
Edited by: Massimo Ruocchio on Jan 26, 2010 9:20 AM
typos

Similar Messages

  • SQL*Plus and NLS_DATE_FORMAT

    So, I haven't visited this topic in a long time, so I'm trying to refresh my memory on how everything works ...
    We set our NLS_DATE_FORMAT at the system level ... what ... 4 years ago to 'MM/DD/RR'. Despite the fact that I set this to something more commonly-used than the default of 'DD-Mon-RR', we've adopted the standard of always using TO_DATE() with an explicit format, just in case it's ever changed.
    There were some applications that missed the standard, and now that a driver (for ColdFusion) has been updated, these SQL statements are now failing.
    When I started looking into it, I realized that the system-level default of 'MM/DD/RR' should work fine. But, after experimenting in SQL*Plus and TOAD, I am thinking that either:
    1) the system-level format is not being used
    2) and/or there are login scripts which are setting these to something else
    Coincidentally, both SQL*Plus and TOAD return the exact same query results:
    SQL> select *
         from NLS_INSTANCE_PARAMETERS
         where parameter = 'NLS_DATE_FORMAT';
    PARAMETER                      VALUE
    NLS_DATE_FORMAT                MM/DD/RR
    SQL> select *
         from NLS_SESSION_PARAMETERS
         where parameter = 'NLS_DATE_FORMAT';
    PARAMETER                      VALUE
    NLS_DATE_FORMAT                DD-MON-RRSo I looked into the glogin.sql script (which both tools share), and there's nothing mentioned about the NLS_DATE_FORMAT
    -- Copyright (c) 1988, 2003, Oracle Corporation. 
    -- All Rights Reserved.
    -- NAME
    --   glogin.sql
    -- DESCRIPTION
    --   SQL*Plus global login "site profile" file
    --   Add any SQL*Plus commands here that are to
    --   be executed when a user starts SQL*Plus, or
    --   uses the SQL*Plus CONNECT command
    -- USAGE
    --   This script is automatically run
    -- Used by Trusted Oracle
    COLUMN ROWLABEL FORMAT A15
    -- Used for the SHOW ERRORS command
    COLUMN LINE/COL FORMAT A8
    COLUMN ERROR    FORMAT A65  WORD_WRAPPED
    -- Used for the SHOW SGA command
    COLUMN name_col_plus_show_sga FORMAT a24
    COLUMN units_col_plus_show_sga FORMAT a15
    -- Defaults for SHOW PARAMETERS
    COLUMN name_col_plus_show_param FORMAT a36 HEADING NAME
    COLUMN value_col_plus_show_param FORMAT a30 HEADING VALUE
    -- Defaults for SHOW RECYCLEBIN
    COLUMN origname_plus_show_recyc   FORMAT a16 HEADING 'ORIGINAL NAME'
    COLUMN objectname_plus_show_recyc FORMAT a30 HEADING 'RECYCLEBIN NAME'
    COLUMN objtype_plus_show_recyc    FORMAT a12 HEADING 'OBJECT TYPE'
    COLUMN droptime_plus_show_recyc   FORMAT a19 HEADING 'DROP TIME'
    -- Defaults for SET AUTOTRACE EXPLAIN report
    COLUMN id_plus_exp FORMAT 990 HEADING i
    COLUMN parent_id_plus_exp FORMAT 990 HEADING p
    COLUMN plan_plus_exp FORMAT a60
    COLUMN object_node_plus_exp FORMAT a8
    COLUMN other_tag_plus_exp FORMAT a29
    COLUMN other_plus_exp FORMAT a44
    -- Used to alter the TOAD environment so that users do not have to
    -- use the SET DEFINE OFF command prior to compiling code
    -- Charles Forbes 10.17.2005
    SET scan offIf I expressly go into either tool and execute, the following, setting the format to that already delcared at the system-level:
    alter session set nls_date_format = 'MM/DD/RR'Then these SQL statements start running just fine again.
    There's something that I'm missing in my basic understanding of how this works. I assumed that the driver update for ColdFusion perhaps enabled a different "glogin.sql"-type script equivalent for that tool ... until ... I started checking into how the NLS_DATE_FORMAT is supposed to work ... but isn't. Could someone help me clarify where the hole is in my understanding?
    Thanks,
    Chuck

    chuckers wrote:
    What's the difference, then, between NLS_SESSION_PARAMETERS and NLS_INSTANCE_PARAMETERS in my initial post? The glogin.sql script isn't altering the NLS_DATE_FORMAT for the desktop version of SQL*Plus, so I'm perplexed that the SESSION format differs from the INSTANCE format.NLS_SESSION_PARAMETERS are the NLS parameters that are in force for your particular session (i.e. the particular connection you have). Most client applications cause things like NLS_DATE_FORMAT to be set, overriding the NLS_INSTANCE_PARAMETERS. Instance-level NLS settings are most commonly used only for purely back-end processing (i.e. background jobs scheduled via DBMS_JOB or DBMS_SCHEDULER, etc.) 9 times out of 10, the client application is going to override the instance-level paramters.
    I even opened SQL Developer, and got
    select * from nls_session_parameters where parameter = 'NLS_DATE_FORMAT';
    PARAMETER                      VALUE                                   
    NLS_DATE_FORMAT                DD-MON-RR                               
    1 rows selected
    select * from nls_instance_parameters where parameter = 'NLS_DATE_FORMAT'
    PARAMETER                      VALUE                                   
    NLS_DATE_FORMAT                MM/DD/RR                                
    1 rows selected
    That's not unexpected. Java applications are going to use the Java regional properties at least to specify a date format. SQL Developer has a config option for the date format, so it may well be specifying a different format.
    They're all 3 (Toad, SQL*Plus, TOAD) so suspiciously consistent, that I'm questioning some of the fundamentals of the NLS setup.
    I went ahead and looked via SQL*Plus from the server-side, & things are looking more consistently in-line with my expectations:
    [oracle@dvsrvr13 ~]$ sqlplus forbesc@d13
    SQL*Plus: Release 10.1.0.4.0 - Production on Thu Mar 19 12:44:57 2009
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Enter password:
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.1.0.4.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    SQL> select * from nls_session_parameters where parameter = 'NLS_DATE_FORMAT';
    PARAMETER                      VALUE
    NLS_DATE_FORMAT                MM/DD/RR
    SQL> select * from nls_instance_parameters where parameter = 'NLS_DATE_FORMAT';
    PARAMETER                      VALUE
    NLS_DATE_FORMAT                MM/DD/RR
    SQL> exit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.4.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    [oracle@dvsrvr13 ~]$ locate glogin.sql
    /u01/app/oracle/product/10.1.0/db_1/sqlplus/admin/glogin.sql
    [oracle@dvsrvr13 ~]$ more /u01/app/oracle/product/10.1.0/db_1/sqlplus/admin/glogin.sql
    -- Copyright (c) 1988, 2003, Oracle Corporation.  All Rights Reserved.
    -- NAME
    --   glogin.sql
    -- DESCRIPTION
    --   SQL*Plus global login "site profile" file
    --   Add any SQL*Plus commands here that are to be executed when a
    --   user starts SQL*Plus, or uses the SQL*Plus CONNECT command
    -- USAGE
    --   This script is automatically run
    -- Used by Trusted Oracle
    COLUMN ROWLABEL FORMAT A15
    -- Used for the SHOW ERRORS command
    COLUMN LINE/COL FORMAT A8
    COLUMN ERROR    FORMAT A65  WORD_WRAPPED
    -- Used for the SHOW SGA command
    COLUMN name_col_plus_show_sga FORMAT a24
    COLUMN units_col_plus_show_sga FORMAT a15
    -- Defaults for SHOW PARAMETERS
    COLUMN name_col_plus_show_param FORMAT a36 HEADING NAME
    COLUMN value_col_plus_show_param FORMAT a30 HEADING VALUE
    -- Defaults for SHOW RECYCLEBIN
    COLUMN origname_plus_show_recyc   FORMAT a16 HEADING 'ORIGINAL NAME'
    COLUMN objectname_plus_show_recyc FORMAT a30 HEADING 'RECYCLEBIN NAME'
    COLUMN objtype_plus_show_recyc    FORMAT a12 HEADING 'OBJECT TYPE'
    COLUMN droptime_plus_show_recyc   FORMAT a19 HEADING 'DROP TIME'
    -- Defaults for SET AUTOTRACE EXPLAIN report
    COLUMN id_plus_exp FORMAT 990 HEADING i
    COLUMN parent_id_plus_exp FORMAT 990 HEADING p
    COLUMN plan_plus_exp FORMAT a60
    COLUMN object_node_plus_exp FORMAT a8
    COLUMN other_tag_plus_exp FORMAT a29
    COLUMN other_plus_exp FORMAT a44
    [oracle@dvsrvr13 ~]$ So in all, I'm just perplexed by the differences.
    --=cfI'm not surprised that SQL*Plus from the Unix database server is going to have session-level settings that match the instance-level settings because there is probably nothing set in the Unix environment that would override the instance-level settings. There is probably no NLS_LANG or NLS_DATE_FORMAT set as environment variables and probably no central place to look for regional settings. Most applications, particularly Windows and Java apps, are going to have multiple places to look for that sort of information.
    Justin

  • Sql plus password typing problem

    Hello there
    I'm trying to access sql plus 11g on windows 7, i correctly write the username but when i try to type the password, nothing is typed at all, not letters nor asteresks!!
    plz help meee

    C:\Users\lord>sqlplus / as sysdba SELECT * V$VERSION;
    SQL*Plus: Release 11.2.0.3.0 Production
    Copyright (c) 1982, 2011, Oracle. All rights reserved.
    Use SQL*Plus to execute SQL, PL/SQL and SQL*Plus statements.
    Usage 1: sqlplus -H | -V
    -H Displays the SQL*Plus version and the
    usage help.
    -V Displays the SQL*Plus version.
    Usage 2: sqlplus [ [<option>] [{logon | /nolog}] [<start>] ]
    <option> is: [-C <version>] [-L] [-M "<options>"] [-R <level>] [-S]
    -C <version> Sets the compatibility of affected commands to the
    version specified by <version>. The version has
    the form "x.y[.z]". For example, -C 10.2.0
    -L Attempts to log on just once, instead of
    reprompting on error.
    -M "<options>" Sets automatic HTML markup of output. The options
    have the form:
    HTML ON [HEAD text] [BODY text] [TABLE text]
    [ENTMAP {ON|OFF}] [SPOOL {ON|OFF}] [PRE[FORMAT] ON]
    -R <level> Sets restricted mode to disable SQL*Plus commands
    that interact with the file system. The level can
    be 1, 2 or 3. The most restrictive is -R 3 which
    disables all user commands interacting with the
    file system.
    -S Sets silent mode which suppresses the display of
    the SQL*Plus banner, prompts, and echoing of
    commands.
    <logon> is: {<username>[<password>][@<connect_identifier>] | / }
    [AS {SYSDBA | SYSOPER | SYSASM}] [EDITION=value]
    Specifies the database account username, password and connect
    identifier for the database connection. Without a connect
    identifier, SQL*Plus connects to the default database.
    The AS SYSDBA, AS SYSOPER and AS SYSASM options are database
    administration privileges.
    <connect_identifier> can be in the form of Net Service Name
    or Easy Connect.
    @[<net_service_name> | [/]Host[:Port]/<service_name>]
    <net_service_name> is a simple name for a service that resolves
    to a connect descriptor.
    Example: Connect to database using Net Service Name and the
    database net service name is ORCL.
    sqlplus myusername/mypassword@ORCL
    Host specifies the host name or IP address of the database
    server computer.
    Port specifies the listening port on the database server.
    <service_name> specifies the service name of the database you
    want to access.
    Example: Connect to database using Easy Connect and the
    Service name is ORCL.
    sqlplus myusername/mypassword@Host/ORCL
    The /NOLOG option starts SQL*Plus without connecting to a
    database.
    The EDITION specifies the value for Session Edition.
    <start> is: @<URL>|<filename>[.<ext>] [<parameter> ...]
    Runs the specified SQL*Plus script from a web server (URL) or the
    local file system (filename.ext) with specified parameters that
    will be assigned to substitution variables in the script.
    When SQL*Plus starts, and after CONNECT commands, the site profile
    (e.g. $ORACLE_HOME/sqlplus/admin/glogin.sql) and the user profile
    (e.g. login.sql in the working directory) are run. The files may
    contain SQL*Plus commands.
    Refer to the SQL*Plus User's Guide and Reference for more information.
    C:\Users\lord>

  • Escape / (Forward Slash) in SQL*Plus

    DB: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    PL/SQL Release 11.1.0.7.0 - Production
    CORE 11.1.0.7.0 Production
    TNS for IBM/AIX RISC System/6000: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - Production
    I am running following anonymous block and it's giving error. It's because SQL Plus is considering forward slash (/) in variable "a" assignment as block terminator. How to escape that? The use of following block is to store test case in Database. This is simple example real test cases are complex and involve print after /.
    DECLARE
      A   varchar2(1024) := NULL;
    BEGIN
      A := 'set serveroutput on;
    BEGIN
      INSERT INTO table_name
           VALUES (5067);
    END ;
        INSERT INTO x VALUES (A) ;
           COMMIT ;
    END ;
    /Output
    SQL> DECLARE
      2    A   varchar2(1024) := NULL;
      3  BEGIN
      4    A := 'set serveroutput on;
      5  BEGIN
      6    INSERT INTO table_name
      7         VALUES (5067);
      8  END ;
      9  /
    ERROR:
    ORA-01756: quoted string not properly terminated
    SQL>
    SQL> ' ;
    SP2-0042: unknown command "' " - rest of line ignored.
    SQL>     INSERT INTO x VALUES (A) ;
        INSERT INTO x VALUES (A)
    ERROR at line 1:
    ORA-00984: column not allowed here
    SQL>
    SQL>        COMMIT ;
    Commit complete.
    SQL> END ;
    SP2-0042: unknown command "END " - rest of line ignored.
    SQL> /
    Commit complete.
    SQL> Running same block from Toad works fine.
    Please help!
    Thank You!
    Arpit

    Welcome to the forums!
    You may need to escape the / character. The default escape character is \
    SQL > DECLARE
      2          A VARCHAR2(1024);
      3  BEGIN
      4          A := '
      5                  BEGIN
      6                          INSERT INTO table_name VALUES (5067);
      7                  END ;
      8                  /
    ERROR:
    ORA-01756: quoted string not properly terminated
    SQL >
    SQL > ' ;
    SP2-0042: unknown command "' " - rest of line ignored.
    SQL > END;
    SP2-0042: unknown command "END" - rest of line ignored.
    SQL > /
    ERROR:
    ORA-01756: quoted string not properly terminated
    SQL >
    SQL >
    SQL > DECLARE
      2          A VARCHAR2(1024);
      3  BEGIN
      4          A := '
      5                  BEGIN
      6                          INSERT INTO table_name VALUES (5067);
      7                  END ;
      8                  \/
      9
    10  ' ;
    11  END;
    12  /
    PL/SQL procedure successfully completed.
            Hope this helps!
    Edited by: Centinul on Jan 28, 2011 1:02 PM

  • EA2 - Export Wizard - No forward slash after package spec and body in sql

    I exported a schema with the export wizard. My stand alone functions and sql types in the script have have a forward slash after the "end;" statement Great. However, package specs and body create statements do not have a forward slash after the "end;" and I believe they also should have this.

    This appears to be a DB issue as we are just using DBMS_METADATA to generate the ddl. Please test manually using worksheet or sqlplus
    exec DBMS_METADATA.SET_TRANSFORM_PARAM( DBMS_METADATA.SESSION_TRANSFORM, 'SQLTERMINATOR' , TRUE );
    select dbms_metadata.get_ddl('PACKAGE', 'PACKAGE_NAME','SCHEMA') from dual;
    I looked through the DB bugs briefly and noticed a few on other objects that were fixed in 9.2.0.6 but I didn't see one for Packages...
    This is not something I would fix in SQL Developer as the core issue is with DBMS_MEATADATA and your version of the DB.
    As this is fixed in 10 I'm sure you can work with support and request a backport if it's not a currently available patch.

  • Checking Module to Prevent SQL Plus usage on Database

    I have a question regarding logon triggers checking against SYS_CONTEXT('USERENV', 'MODULE'). I created a logon trigger that looks for SYS_CONTEXT('USERENV', 'MODULE') = 'SQLPLUS.EXE'
    and if it matches then it only allows specified users to log in to the database. This code works but I am confused as to why when I check SYS_CONTEXT('USERENV', 'MODULE') after I login in
    shows SQL*Plus which clearly does not match my IF statement in my logon trigger.
    Second issue. If I rename sqlplus.exe to jeff.exe and run it I am abled to log in to the database as a non DBA user. But the module still shows as SQL*Plus. Why is this?
    Database Version: 11.2.0.2 64bit
    OS: Windows Server 2003 R2
    Client: 11.2.0.1
    /*********************Create Trigger******************************/
    CREATE OR REPLACE TRIGGER application_check_al
      after logon ON database 
    DECLARE
      l_username VARCHAR2(20);
      l_module   VARCHAR2(20);
    BEGIN
      l_username := SYS_CONTEXT('USERENV', 'SESSION_USER');
      l_module   := UPPER(SYS_CONTEXT('USERENV', 'MODULE'));
      IF l_module LIKE 'SQLPLUS.EXE' AND
         l_username NOT IN ('SYS', 'SYSTEM', 'DVOWNER', 'DVMGR') THEN
        raise_application_error(-20001, 'SQLPLUS ACCESS RESTRICTED FOR NON DBA USERS');
      END IF;
    END application_check_al;
    /*********************Run SQLPLUS******************************/
    SQL*Plus: Release 11.2.0.1.0 Production on Wed Mar 7 12:22:23 2012
    Copyright (c) 1982, 2010, Oracle.  All rights reserved.
    Enter user-name: jeffc@dev
    Enter password:
    ERROR:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-20001: SQLPLUS ACCESS RESTRICTED FOR NON DBA USERS
    ORA-06512: at line 10
    Enter user-name: system@dev
    Enter password:
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining, Oracle Database Vault
    and Real Application Testing options
    system@dev> select sys_context('USERENV','MODULE') from dual;
    SYS_CONTEXT('USERENV','MODULE')
    SQL*Plus
    SQL>

    jeff81 wrote:
    That doesn't make sense. Why am I able to log in when I renamed the exe? And why does the module still show as SQL*Plus?You are right - it does not make sense. The idea that Oracle might perhaps set module to SQLPLUS.EXE on executable start, and then re set from SQLPLUS.EXE to SQL*Plus after connect, or in glogin.sql, to ensure it is consistent across all operating system never crossed my mind.
    You might want to refer to Support Note "SQL*Plus Session/Module is Not Showing in V$SESSION" [ID 1312340.1] to see whether anything in there helps. I'm pretty sure http://docs.oracle.com/cd/E11882_01/server.112/e16604/ch_twelve040.htm#i2698573 doesn't help much, though.
    I'd certainly be raising it with Support as a potential security challenge, to get that potential hole closed.
    Edited by: Hans Forbrich on Mar 7, 2012 2:23 PM
    I wonder whether Oracle put that capability in there - if an untained SQLPLUS.EXE, it tells you that it is SQLPLUS.EXE, but if renamed it tells you 'SQL*Plus'? Specuklation, but it is one thing I might do to subtly raise the flag. Best bet - ask Support.
    Edited by: Hans Forbrich on Mar 7, 2012 2:29 PM

  • Strange error in sql*plus in a line with "&"

    Hi friends, this error is very strange:
    Open your SQL*PLUS.
    write this:
    DECLARE
    V_1 VARCHAR2(10);
    V_2 VARCHAR2(10);
    BEGIN
    V_1:=&var1;
    --V_2:=&var2;
    END;
    Why it ask me for a value to var2 ???????????
    Does it ignore the -- at the begining of the line
    (same result with /* */ )
    Thanks,
    Jose.

    It is not an error.
    There are two parsers here doing their thing. The SQL*Plus Parser. The Oracle (SQL and/or PL/SQL) parser.
    SQL*Plus reads a line at a time and processs it. It has no idea whether or a line is actually a comment line for SQL or PL/SQL. It however does see that the line contains a SQL*PLUS substitution variable called &var2. Thus it prompts for a value for this variable (as VERIFY is ON). It substitutes &var2 with the value that the user supplies.
    When the SQL*Plus parser encounters the end-of-block marker (the forward slash in this case), it transmits that block to the Oracle Server for execution. There the Oracle Server runs it through the PL/SQL or SQL parsers (depending on whether the block is SQL or anonymous PL/SQL).
    Nothing strange about it. Nothing wrong with it.

  • SQL*Plus: list of characters that need to be escaped

    Hi all,
    We have a requirement where we need to add comments to tables and table columns and this is done using SQL*Plus. I understand that there are some special characters that are interpreted by SQL*Plus such as ampersand (&). I would like to know the list of such characters so that we can escape them before passing it on to CREATE COMMENT ON statement. So far we have identified the following special characters:
    The following characters need to be escaped no matter where they are present in the comment
    single quote "'" (hex 27)
    define "&" (hex 26)
    sqlterminator ";" (hex 3b)
    The following characters need to be escaped when they are the only character on a line
    forward slash "/" (hex 2f)
    blockterminator "." (hex 2e)
    sqlprefix "#" (hex 23)
    The following characters need to escaped if they are followed by a newline
    line continuation "-" (hex 2d)
    We would like to know if there are other special characters and appreciate if someone can provide the list.
    Thanks
    Edited by: user779842 on Aug 20, 2009 3:37 AM
    Edited by: user779842 on Aug 20, 2009 3:55 AM

    I think the only two characters you need to worry about in your comment strings are: ' and & (apostrophe/single quote and ampersand). The latter you can get around by doing:
    set define offbefore running your statements, but the apostrophe you'll have to double up to allow oracle to recognise that it's not the end of the string. Eg:
    I'm a stringwould become
    'I''m a string'  -- NB. this is two single quotes, not 1 double quote!or, if you're on 10g or above, you can use the quote operator (q):
    select q'#I'm a string#' from dual;See the documentation for what characters can be used as the quote delimiters: http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_sqltypes.htm#sthref377

  • Semicolon and / in SQL Plus scripts?

    Anyone,
    Seem to have some confusion over the use of / and ; inside PL SQL Scripts run in SQL Plus.
    I seem to get two commits thereby two rows on INSERT clase that has a ; and a /.
    i.e.
    /* Insert record into table for recording statistics on the runtime of this script */
    INSERT INTO MYTABLE ( col1, col2) VALUES ( value1, value2);
    COMMIT;
    /The above will get two of the same rows in the table. Is this an issue with SQL Plus settings? What do people typically use? I have a combination of SQL and DDL in my scripts and I need / for the DDL typically as I understand. How do othere intermix these and what standard is used.

    Dave, here are the very basics.
    The SQL language does not have command separators as only a single command at a time can be issued. Thus the following is invalid SQL:
    SELECT * FROM emp;
    The semicolon as command separator (or terminator) is not valid SQL. This is valid SQL:
    SELECT * FROM emp
    PL/SQL is a programming language similar to Pascal, C and Java. Multiple commands are used in a program. These need to be separated so that the parser/compiler can know where a command starts and where it ends. In PL/SQL the semicolon is used.
    The following is invalid PL/SQL as it is missing command separators:
    declare
    i integer
    begin
    i := 1234
    endThe following is valid PL/SQL :
    declare
    i integer;
    begin
    i := 1234;
    end;SQL*Plus is an Oracle CLI (command line interface) client. It can submit both SQL and PL/SQL to the database. It needs to know when you have stopped entering commands into its input buffer and to submit what you've entered to the database.
    SQL*Plus uses two characters for this. The semicolon and the forward slash. If you want to submit the above SELECT to Oracle using SQL*Plus, SQL*Plus needs to know when to submit its input buffer's content - thus:
    SQL> SELECT * FROM emp;
    Or:
    SQL> SELECT * FROM emp
    SQL> /
    When using PL/SQL in SQL*Plus, SQL*Plus "understands" that the semicolons you use are for the PL/SQL language - not an instruction from you to it to submit its buffer to Oracle for execution.
    The forward slash can also be at anytime used to resubmit the current SQL*Plus input buffer again. E.g.
    SQL> SELECT * FROM emp;
    .. now do the last SQL (or PL/SQL) in the buffer again
    SQL> /[i]

  • SQL*plus not executing query

    Hello,
    I am new to sqlplus and I am trying to get some queries running off of an ARCH linux box that I have.
    The install went ok and I can get sqlplus running and connect to my oracle DB. However when I enter something as easy as "select * from REASON" hit enter, all i get is a "2" on the next line
    (screenshot http://imgur.com/KvTyD.jpg)
    Is this a config issue on my sqlplus or am i Just not qualified. Any help is appreciated. thanks

    >
    I am new to sqlplus and I am trying to get some queries running off of an ARCH linux box that I have.
    The install went ok and I can get sqlplus running and connect to my oracle DB. However when I enter something as easy as "select * from REASON" hit enter, all i get is a "2" on the next line
    (screenshot http://imgur.com/KvTyD.jpg)
    Is this a config issue on my sqlplus or am i Just not qualified. Any help is appreciated. thanks
    >
    SQL*Plus is expecting input from you; you terminate the statement by putting a forward slash or semi-colon just after your statement.
    select * from REASON
    /OR
    select * from REASON;Regards,
    Phiri

  • Got SQL *Plus query output in more than one in a single page

    Hi All,
    I have write a SQL *Plus code for execute one SQL query and registered as concurrent program. But I have got the output more than once in a single page after running the concurrent program. I am not getting what is the my code problem. Please can any one help me.
    This is my SQL code.
    -- These commands are added by applications concurrent manager
    SET TERMOUT OFF
    SET PAUSE OFF
    SET HEADING OFF
    SET FEEDBACK OFF
    SET VERIFY OFF
    SET ECHO OFF
    WHENEVER sqlerror exit failure
    -- set user environment
    SET pagesize 999
    SET linesize 860
    SET appinfo on
    SET tab off
    SET newpage none
    SET heading on
    --SET colsep ','
    -- define heading/footer
    --ttitle -
    -- left currdate -
    -- center 'SSFT Open PO Report' -
    -- right 'Page : ' format 999 sql.pno -
    -- skip 1 -
    -- center 'Organization US / Type Contract Labor / Status - Open' -
    -- skip 2
    --btitle -
    -- skip 1 -
    -- center 'Scansoft Inc. - All information confidential'
    -- define columns
    CLEAR columns
    SET heading on
    COLUMN c1 format a30 heading '"Last Name"' trunc
    COLUMN c2 format a30 heading '"First Name"' trunc
    COLUMN c3 format a50 heading '"Employee Name"' trunc
    COLUMN c4 format a20 heading '"Timecard Number"' trunc
    COLUMN c5 format a40 heading '"Expenditure Batch"' trunc
    COLUMN c6 format a24 heading '"Weekending Date"' trunc
    COLUMN c7 format a24 heading '"Expenditure Item Date"' trunc
    COLUMN c8 format a20 heading '"Expendtrmonth"' trunc
    COLUMN c9 format a20 heading '"Expendtryear"' trunc
    COLUMN c10 format a24 heading '"Sortdate"' trunc
    COLUMN c11 format 999999999 heading '"Task Id"'
    COLUMN c12 format a30 heading '"Task Name"' trunc
    COLUMN c13 format a30 heading '"Task Number"' trunc
    COLUMN c14 format a24 heading '"Closed Date"' trunc
    COLUMN c15 format a30 heading '"Project Name"' trunc
    COLUMN c16 format a30 heading '"Project Number"' trunc
    COLUMN c17 format a30 heading '"Project Status Code"' trunc
    COLUMN c18 format a30 heading '"Expenditure Type"' trunc
    COLUMN c19 format a30 heading '"Expenditure Org Name"' trunc
    COLUMN c20 format 999999999 heading '"Organization Id"'
    COLUMN c21 format a50 heading '"Projmrg"' trunc
    COLUMN c22 format a25 heading '"Role"' trunc
    COLUMN c23 format a24 heading '"Projmrg Start Date"' trunc
    COLUMN c24 format a24 heading '"Projmrg Start Date"' trunc
    COLUMN c25 format a35 heading '"Job Name"' trunc
    COLUMN c26 format a35 heading '"Project Type"' trunc
    COLUMN c27 format 999999999.99 heading '"Quentity"' trunc
    -- define breaks & computes
    --break -
    -- on report skip 2 -
    -- on c30 -
    -- on c20 skip 1
    --compute avg label 'Average' of c210 on report
    -- select statement here
    SELECT papf.last_name || '' c1, papf.first_name || '' c2,
    papf.full_name || '' c3, pea.orig_user_exp_txn_reference || '' c4,
    pea.expenditure_group || '' c5, pea.expenditure_ending_date || '' c6,
    peia.expenditure_item_date || '' c7,
    SUBSTR (TO_CHAR (peia.expenditure_item_date), 4, 3) || '' c8,
    SUBSTR (TO_CHAR (peia.expenditure_item_date), 8, 2) || '' c9,
    TO_DATE (SUBSTR (TO_CHAR (peia.expenditure_item_date), 4, 6),
    'MM/YY'
    || '' c10,
    peia.task_id || '' c11, pt.task_name || '' c12,
    pt.task_number || '' c13, ppa.closed_date || '' c14, ppa.NAME || '' c15,
    ppa.segment1 || '' c16, ppa.project_status_code || '' c17,
    pet.expenditure_type || '' c18, haou.NAME || '' c19,
    haou.organization_id || '' c20, pppv.full_name || '' c21,
    pppv.ROLE || '' c22, pppv.start_date_active || '' c23,
    pppv.end_date_active || '' c24, pj.NAME || '' c25,
    ppa.project_type || '' c26, peia.quantity || '' c27
    FROM pa.pa_expenditures_all pea,
    pa.pa_expenditure_items_all peia,
    pa.pa_tasks pt,
    pa.pa_projects_all ppa,
    hr.per_all_people_f papf,
    hr.hr_all_organization_units haou,
    pa.pa_expenditure_types pet,
    apps.pa_project_players_v pppv,
    hr.per_jobs pj
    WHERE pea.expenditure_id = peia.expenditure_id
    AND peia.task_id = pt.task_id
    AND peia.job_id = pj.job_id
    AND pt.project_id = ppa.project_id
    AND pea.incurred_by_person_id = papf.person_id
    AND pea.incurred_by_organization_id = haou.organization_id
    AND pet.expenditure_type = peia.expenditure_type
    AND ppa.project_id = pppv.project_id
    AND pppv.end_date_active IS NULL
    AND pea.expenditure_ending_date >= SUBSTR (SYSDATE - 545, 1, 9)
    ORDER BY papf.full_name ASC,
    pea.expenditure_ending_date ASC,
    peia.expenditure_item_date ASC;
    --spool off
    Thanks in advance
    --Subhas                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Hi
    Either remove the semicolon (;) or the slash (/) at the end of your query, as both will execute it.

  • SQL PLUS acitvity in process flow

    I looked at other threads and did exactly the same but I am getting a error. Any ideas.
    I created a variable as counter.
    In sqlplus activity Paramter List I did not do anything. for result code I did the binding as counter which is my variable.In script I put in the below code.
    VARIABLE COUNTER_PPAL NUMBER;
    DECLARE
    BEGIN
    SELECT COUNT(*) INTO :COUNTER_PPAL FROM TEMP_TABLE
    END;
    EXIT :COUNTER_PPAL
    The error I am getting is
    SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jan 25 08:30:15 2010
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    Session altered.
    END;
    ERROR at line 4:
    ORA-06550: line 4, column 4:
    PLS-00103: Encountered the symbol "end-of-file" when expecting one of the
    following:
    begin case declare end exception exit for goto if loop mod
    null pragma raise return select update while with
    <an identifier> <a double-quoted delimited-identifier>
    <a bind variable> << close current delete fetch lock insert
    open rollback savepoint set sql execute commit forall merge
    pipe
    SP2-0670: Internal number conversion failed
    Usage: { EXIT | QUIT }     [ SUCCESS | FAILURE | WARNING | n |
    <variable> | :<bindvariable> ] [ COMMIT | ROLLBACK ]
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options

    I was missign a semi colon after my select statement.

  • How to Hide password when invoking sql plus from command promt?

    When i try to open sql plus in command prompt window and enter the sqlplus command follwed by username/password@connection string, the password is not hidden.
    How do I get it to show **** instead of displaying password characters out?
    Also, what is the command to clear screen : when I try cls or clear screen, I get a windows memory exception of somekind and the only option there is to kill the command window.
    Any tips on getting around this?
    Thanks a lot for your time and help.

    user8848256 wrote:
    Can you please give more details on how to not enter password when calling sqlplus from command window like you are saying?
    I tried this :
    sqlplus username/ @connection string -->Hit Enter : it asks for password but does not recognise the connectionstring to connect to.
    sqlplus username/ -->Hit Enter: It does same thing again.asks for password but gives tns adapter error after the password is entered.Leave out the slash:
    sqlplus username@connect_string

  • Re: SQL Plus Error ORA - 12560 TNS:Protocol Adapter error

    I am using Oracle 9i
    On Windows XP Home
    I am trying to learn and become familiar with Oracle 9i
    I get the above error whenever I try to log on to SQL Plus
    I use the following Id scott
    and the following Password Tiger
    and the above error comes up
    now I can't log on to Oracle9i SQL
    I tried going into Start, Control Panel, Administrative Tools, Services
    I see the Oracle SID which says Automatic, Started
    But I am unable to still logon
    Anyone has a solution
    Assistance would be appreciated
    The solution can be printed here as well as please forward a copy to [email protected]
    Thanks

    Here is the following output of your instructions
    sc query oracleserviceoracle
    SERVICE_NAME: ORACLESERVICEORACLE
    TYPE: 10 WIN32_OWN_PROCESS
    STATE: 4 RUNNING
    (STOPPABLE, PAUSABLE, ACCEPTS_SHUTDOWN)
    WIN32_EXIT_CODE: 0 (0X0)
    SERVICE_EXIT_CODE: 0 (0X0)
    CHECKPOINT: 0X0
    WAIT_HINT: 0X0
    set | find "ORACLE"
    comes back empty
    set | find "oracle"
    JSERV=J:\oracle\ora92/Apache/Jserv/conf;C:\oracle\ora92/Apache/Jserv/conf
    Path=J:\oracle\ora92\bin;C:\oracle\ora92\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\MSSQL7\BINN;"C:\Program Files\Zone Labs\ZoneAlarm\MailFrontier";C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\Executive Software\DiskeeperLite\;C:\Program Files\CA\PPRT\bin;C:\Program Files\SSH Communications Security\SSH Secure Shell;;J:\Acucobol\BIN
    WV_GATEWAY_CFG=J:\oracle\ora92\Apache\modplsql\cfg\wdbsvr.app
    ebrian
    Yes I realize that the JSERV is pointing in the incorrect are
    the J drive is a flashdrive
    In the Registry I have just deleted the 2nd Orahome directory which was on the J drive
    so all I have now left is the Orahome directory on the C drive
    how do I make corrections so that from now on the JSERV, Path, and WV_Gateway._CFG point to the C drive

  • SQL*Plus variable assignment works for 8i but not 9i

    We have scripts that connect to each database on the box and perform database tasks nightly. The scripts first set the environment then connects to each database with SQL*Plus. This works for 8i but fails in the recently created 9i environment. (Unix Solaris environment)
    Because the SQL*Plus connection appears in many areas in the scripts, we assign the following connection string to a variable:
    SQLPLUS="/usr/oracle/product/9.2.0/bin/sqlplus -s 'xxx/xxxxxx@xxxx as sysdba'"
    Export SQLPLUS
    echo "$SQLPLUS"
    (This echo out correctly: /usr/oracle/product/9.2.0/bin/sqlplus -s 'xxx/xxxxxx@xxxx as sysdba')
    It fails when the script calls the assigned variable:
    $SQLPLUS <<-EOF
    with the following error:
    Usage: SQLPLUS [ [<option>] [<logon>] [<start>] ]
    where <option> ::= -H | -V | [ [-L] [-M <o>] [-R <n>] [-S] ]
    <logon> ::= <username>[<password>][@<connect_string>] | / | /NOLOG
    <start> ::= @<URI>|<filename>[.<ext>] [<parameter> ...]
    "-H" displays the SQL*Plus version banner and usage syntax
    "-V" displays the SQL*Plus version banner
    "-L" attempts log on just once
    "-M <o>" uses HTML markup options <o>
    "-R <n>" uses restricted mode <n>
    "-S" uses silent mode
    However, if I remove the SQLPLUS variable assignment and changed all occurrence of
    $SQLPLUS <<-EOF to
    /usr/oracle/product/9.2.0/bin/sqlplus -s 'xxx/xxxxxx@xxxx as sysdba' <<-EOF
    Then the script runs successfully. But this solution is cumbersome.
    Any ideas as to how to have the script work with assigning the SQLPLUS variable????
    Any help is appreciated.

    I has an immediate suspicion it might be related to the issue
    mentioned in
    http://otn.oracle.com/support/tech/sql_plus/htdocs/sub_var2.html#2_7
    but this proved wrong: the SP2-306 still occurs in the latest
    SQL*Plus.
    I wonder what version of 8i you had working? With an old SQL*Plus
    8.1.7.0 my connection failed the same as in 9.2 and 10i.
    My solution was to do:
      SQLPLUS='sqlplus -s'
      UNPW='/ as sysdba'
      $SQLPLUS "$UNPW" &lt;&lt;EOF
      EOFThis worked in 9.2.0.5, 10.1.0.2 and 8.1.7.0.
    One common security risk on UNIX remains: putting the username and
    password on the command line. On some systems a "ps" command will
    show the password to any user. If OS authentication cannot be used
    for connection, perhaps putting the username/password in the SQL
    script may be more secure?
    A final note is that in SQL*Plus 10g, no quotes are needed around
    AS SYSDBA, i.e.
      sqlplus / as sysdba works from the OS prompt, whereas in 9.2 you need to do
      sqlplus "/ as sysdba"This makes a solution easy:
      SQLPLUS="/usr/oracle/product/10.1.0/bin/sqlplus -s xxx/xxxxxx@xxxx as sysdba"-- CJ

Maybe you are looking for

  • Native photo's at 3264*1836 (16:9) format

    Hi there, I am switched from a Nokia C6-01 to a Iphone S4. The Nokia C6-01 had the possibilty to take photo's at many resolutions, 3264*1836 (16:9) 6 megpix format was one of them. However so far as i know the Iphone 4S knows default only one format,

  • Portal

    Hi, Is it possible to implement vendor neutral portal? I need to maintain a weblogic portal. It's totally locked in weblogic since it uses jpf, netui, etc.. what's the best approach to avoid vendor specifics. Thanks

  • My Ipod deleted all my music! (2nd time)

    It's so frustrating! My Ipod has always had connection problems. It disconnects from car Ipod hookups, and when I plug it into the computer, all it takes is a slight brushing against the cord to make it eject unprovoked. BUT this is the second time i

  • Does installing Desktop Experience on Windows Server 2008 R2 SP1 slow down the server / increase processor usage?

    Hello. I'm running a tekkit classic (Minecraft) Server on a dedicated server I got from OVH, Im just wondering - Im currently using ClamAV for an antivirus, But I would like windows defender. Im wondering if installing Desktop Experience on my dedi w

  • 10.1.3r3 - JAZN Data Properties dialog bug

    JDev team, The JAZN Data Properties dialog in 10.1.3r3 has a bug. Once you've defined your own realm, users and policies in a jazn-data.xml file, closing and returning to the dialog for the same file you cannot see the entries you previously made wit