PL/SQL With UNIX

HI All,
I am new to Unix environment. I would like to know how can we use PL/SQL block in Unix. i.e., connect to oracle, compile PL/SQL, execute PL/SQL, etc.
Please suggest me some useful links or Books
My Oracle Version is :Oracle 10GR2
Thanks in Advance.
NM

I would suggest you enroll yourself in a beginning Oracle database class and learn what PL/SQL is and how it works.
PL/SQL, as a language, is not operating system dependent. You write the exact same code and use it the exact same way whether on an IBM zSeries mainframe, Linux, UNIX, Windows, or a Mac.
The docs are at http://tahiti.oracle.com.
Start with the "Concept" docs while looking for a good class.

Similar Messages

  • How to find sql statement with Unix process pid

    Hi
    how to find sql statement with Unix process pid
    is there any view to find that.
    please if so let me know
    Thanks in advance

    this is how I am doing this:
    oracle 7352340 7459066 0 07:47:10 - 0:00 oracleJDERED (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
    oracle 7459066 5386396 2 07:47:10 pts/1 0:01 sqlplus
    select sid,serial# from v$session where process='7459066';
    SID SERIAL#
    2178 6067
    select sql_text
    from
    v$sqlarea a,
    v$session b
    where a.hash_value = b.sql_hash_value
    and b.sid = 2178
    ;

  • Script fails when passing values from pl/sql to unix variable

    Script fails when passing values from pl/sql to unix variable
    Dear All,
    I am Automating STATSPACK reporting by modifying the sprepins.sql script.
    Using DBMS_JOB I take the snap of the database and at the end of the day the cron job creates the statspack report and emails it to me.
    I am storing the snapshot ids in the database and when running the report picking up the recent ids(begin snap and end snap).
    From the sprepins.sql script
    variable bid number;
    variable eid number;
    begin
    select begin_snap into :bid from db_snap;
    select end_snap into :eid from db_snap;
    end;
    This fails with the following error:
    DB Name DB Id Instance Inst Num Release Cluster Host
    RDMDEVL 3576140228 RDMDEVL 1 9.2.0.4.0 NO ibm-rdm
    :ela := ;
    ERROR at line 4:
    ORA-06550: line 4, column 17:
    PLS-00103: Encountered the symbol ";" when expecting one of the following:
    ( - + case mod new not null <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> avg
    count current exists max min prior sql stddev sum variance
    execute forall merge time timestamp interval date
    <a string literal with character set specification>
    <a number> <a single-quoted SQL string> pipe
    The symbol "null" was substituted for ";" to continue.
    ORA-06550: line 6, column 16:
    PLS-00103: Encountered the symbol ";" when expecting one of the following:
    ( - + case mod new not null <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> avg
    count current exists max min prior sql stddev su
    But when I change the select statements below the report runs successfully.
    variable bid number;
    variable eid number;
    begin
    select '46' into :bid from db_snap;
    select '47' into :eid from db_snap;
    end;
    Even changing the select statements to:
    select TO_CHAR(begin_snap) into :bid from db_snap;
    select TO_CHAR(end_snap) into :eid from db_snap;
    Does not help.
    Please Help.
    TIA,
    Nischal

    Hi,
    could it be the begin_ and end_ Colums of your query?
    Seems SQL*PLUS hs parsing problems?
    try to fetch another column from that table
    and see if the error raises again.
    Karl

  • Scripting pl/sql from unix

    I am wondering if there is a way to do this with certain restrictions. If not, I can do it another way.
    1. I have a list of values in a unix .txt file of the form
    VALUEA
    VALUEB
    VALUEC
    I know how to read a list in unix using a loop.
    2. I want to call a pl/sql anonymous block that I have in a .sql file 1 time for every value in this script and pass the value.
    I do know how to read a value and then pass it to a pl/sql parameter and then call the pl/sql parameter.
    What I don't know how to do is
    Do this with only logging into sqlplus one time. I dont want to do the following
    unix runs in a loop
    reads 1 record from file
    logs into sqlplus
    runs the procedure and passes the value
    log out of sqlplus
    end loop
    I want to
    1. read all the values from the file
    2. store it somehow in memory (variable of some sort)
    3. pass this value to the pl/sql procedure
    I do not want to make any objects in the database such as a global temporary table.
    Yes I can actually do this, but wondering if it is possible to avoid. Makes it easier to deploy to alot of different databases. If I have to make a database object, then i have to make an object in alot of databases. If I can run it all from unix, all I have to do is change the target and the password. So it is easier to deploy.

    I don't need to put this in an Oracle Directory. I am not calling anything from pl/sql stored in the database. It is going to all be done with unix scripts and anonymous block sql in .sql statements in the OS. This allows me to take advantage of clustered storage (I can have alot of databases servers mounted on 1 directory). So the unix script will log into oracle and call the .sql script.
    I can build the pl/sql dynamically. I'd rather not do that. The thing is I have alot of databases I want to deploy code to. So I am trying to come up with a pattern I can follow. So if I add a new database or what to deploy somewhere else, I can just use add a line to a file.
    Adding database objects every time I need to deploy to a new database is a pain. It is far more scaleable to handle all of this in unix.
    Edited by: Guess2 on Jan 12, 2010 7:43 AM

  • Send mail from PL/SQL with an attachment

    Hi,
    Can any body help me on how to send a mail from PL/SQL with an attachment which is located on a unix system path.
    This is an urgent requirement in my current project. Any quick reply would be greatly appreciated.
    Thanks
    Kumar.

    Quick reply (too bad you didn't mention your DB-version):
    Check the docs @ http://tahiti.oracle.com regarding packages UTL_SMTP and UTL_MAIL
    Check http://asktom.oracle.com/pls/asktom/asktom.search?p_string=%22mail+attachment%22
    Check http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html
    Check http://www.oracle-base.com/articles/10g/PlsqlEnhancements10g.php#UTL_MAIL

  • Samba - Can't write to a share with "unix extensions = no" set in smb.

    Hello @all!
    Unfortunately, I have a problem, writing to a samba share which I'm unable to solve.
    My /etc/samba/smb.conf :
    [global]
    workgroup = w
    server string = server
    security = user
    load printers = no
    log file = /var/log/samba/%m.log
    max log size = 50
    dns proxy = no
    printing = bsd
    printcap name = /dev/null
    disable spoolss = yes
    unix extensions = no
    # if I comment above line, I can write to /home/shareuser/writable
    follow symlinks = yes
    wide links = yes
    [writable]
    comment = test
    writable = yes
    valid users = shareuser
    path=/home/shareuser/writable
    shareuser has valid passwd and smbpasswd (-a)
    I mount the share like this:
    mount -t cifs //server/writable mountpoint/ -o username=shareuser
    With
    unix extensions = yes
    , I can write to the share.
    With
    unix extensions = no
    , I can't write to the share.
    What I try to achieve in the end, is to have a writable password protected share, which forwards file permissions to clients and also allows them to access directories and files which are symlinked into the share directory (both from linux and windows clients if that's even possible).
    PS: I also posted this on stackexchange.com (http://unix.stackexchange.com/questions … n-smb-conf)
    PPS: Since I'm using systemd without syslog I had to create the /var/log/samba directory before smbd logged anything.
    Thank you in advance for any help
    Last edited by MCH (2012-09-23 20:59:41)

    First off, don't use finalize(). It is never guaranteed to actually run.
    Just add a cleanup() method to your Account class that flushes and closes the writer; and call it before you exit main().
    Now, as for your Date problem
    java.util.Date certainly does have a no-args constructor.
    java.sql.Date does not.
    Make sure you aren't getting a name collision. (Hint: If you're doing import java.foo.* Stop Doing That. just import the classes you need)

  • Oracle carrer with unix advice

    hi
    iam working in a reputed mnc with CMMi level 5 .Started as fresher (BE I.T) i have around 1.6 years of experiance in unix scripting/oracle sql production support.
    with learning of sql and shell scripting
    i want to make my career in oracle which should be more dynamic,learning and creative not like in production support which have monotonus life.
    could anyone please guide me about what career path i should choose ?
    DBA , i have heard is montonous job too with same routine backups,no creativity with nightshifts and all, but it is more stable as people said. I have no experiance of it.
    second devolper track in sql/pl sql having its own limitations like less demand, less financial growth etc. and people usually wants to shift in other area like BO
    i don`t have any info about others areas like that i would like to explore and choose any one of them as carreer
    which one would be best with my current knowledge
    1)Datawarehousing
    2)Oracle apps
    3)Business objects (BO reporting)
    4)Oracle CRM etc
    5)Others (thats all i know,please add some others if they are creative )
    Problem area:
    1)iam really confused now which way to choose devopment or support
    2)how to jump in other company on wat basis? Since iam in prod support they will hire me for the same again
    3)How could i get to others areas like CRM,BO datawarehouse,apps ?As they more demanding and good learning and future path
    4)wat to do right now at this position?
    preparing for OCA right now but uncertain for career.
    Seeking good help from forum experts.

    Duplicate posting is considered as abuse/spamming
    Re: oracle career with unix scripting?
    Srini

  • If..then..else statement in SQL with 'generalized' conditions in the if sta

    it is possible to write something approaching an if..then..else statement in SQL with 'generalized' conditions in the if statement.
    Attached is the query for the payment register, in which I've written a series of decode statements, one for each possible value of the payment code. The query works OK - however, its specific and as the number of paycodes expand (and they do), the report won't pick up the new paycode until the code is changed. More importantly, the report won't be correct until someone 'discovers' that a paycode is missing, which might take months.
    If I were writing the equivalent of this series of decode statements in Focus, it would be something like this:
    DEFINE.......
    PAYMED/D12.2 = IF PAYMENT_CD LE 18
                   THEN PAYMENT_AMT
                   ELSE 0 ;
    PAYIND/D12.2 = IF PAYMENT_CD GE 19 AND PAYMENT_CD LE 49
                   THEN PAYMENT_AMT
                   ELSE 0 ;
    PAYEXP/D12.2 = IF PAYMENT_CD GE 70
                   THEN PAYMENT_AMT
                   ELSE 0 ;
    PAYREC/D12.2 = IF PAYMENT_CD GE 50 AND PAYMENT_CD LE 69
                   THEN PAYMENT_AMT
                   ELSE 0;
    END
    IN SQL/PLUS:
    SELECT ACCOUNT_NAME,
    LOCATION_1,
    CLMNT_LAST_NAME,
    CLAIM_NBR,
    DATE_OF_INJURY,
    DATE_CHECK_REGISTER,
    PAYEE_NAME_1,
    PAYMENT_CD,
    SERV_OFC,
    CPO_CHECK_NBR,
    PAYMENT_FORM,
    DECODE(PAYMENT_CD, 20, PAYMENT_AMT, 21, PAYMENT_AMT,
    22, PAYMENT_AMT, 23, PAYMENT_AMT, 25, PAYMENT_AMT,
    26, PAYMENT_AMT, 27, PAYMENT_AMT, 28, PAYMENT_AMT,
    29, PAYMENT_AMT, 30, PAYMENT_AMT, 31, PAYMENT_AMT,
    32, PAYMENT_AMT, 33, PAYMENT_AMT, 34, PAYMENT_AMT,
    35, PAYMENT_AMT, 36, PAYMENT_AMT, 37, PAYMENT_AMT,
    39, PAYMENT_AMT, 40, PAYMENT_AMT, 41, PAYMENT_AMT,
    42, PAYMENT_AMT, 43, PAYMENT_AMT, 44, PAYMENT_AMT,
    45, PAYMENT_AMT, 46, PAYMENT_AMT, 47, PAYMENT_AMT,
    48, PAYMENT_AMT, 49, PAYMENT_AMT, NULL) INDEMNITY,
    DECODE(PAYMENT_CD, 0, PAYMENT_AMT, 1, PAYMENT_AMT,
    2, PAYMENT_AMT, 3, PAYMENT_AMT, 4, PAYMENT_AMT,
    5, PAYMENT_AMT, 6, PAYMENT_AMT, 7, PAYMENT_AMT,
    8, PAYMENT_AMT, 9, PAYMENT_AMT, 10, PAYMENT_AMT,
    11, PAYMENT_AMT, 12, PAYMENT_AMT, 13, PAYMENT_AMT,
    14, PAYMENT_AMT, 15, PAYMENT_AMT, 18, PAYMENT_AMT,
    17, PAYMENT_AMT, NULL) MEDICAL,
    DECODE(PAYMENT_CD, 70, PAYMENT_AMT, 71, PAYMENT_AMT,
    72, PAYMENT_AMT, 73, PAYMENT_AMT, 74, PAYMENT_AMT,
    75, PAYMENT_AMT, 76, PAYMENT_AMT, 77, PAYMENT_AMT,
    78, PAYMENT_AMT, 79, PAYMENT_AMT, 80, PAYMENT_AMT,
    81, PAYMENT_AMT, 82, PAYMENT_AMT, 83, PAYMENT_AMT,
    84, PAYMENT_AMT, 85, PAYMENT_AMT, 86, PAYMENT_AMT,
    87, PAYMENT_AMT, 88, PAYMENT_AMT, 89, PAYMENT_AMT,
    90, PAYMENT_AMT, NULL) EXPENSES,
    DECODE(PAYMENT_CD, 50, PAYMENT_AMT, 51, PAYMENT_AMT,
    52, PAYMENT_AMT, 53, PAYMENT_AMT, 54, PAYMENT_AMT,
    55, PAYMENT_AMT, 56, PAYMENT_AMT, 57, PAYMENT_AMT,
    58, PAYMENT_AMT, NULL) RECOVERIES,
    DECODE(PAYMENT_FORM, 'N', PAYMENT_AMT, NULL) NONCASH,
    DATE_FROM_SERVICE,
    DATE_THRU_SERVICE
    FROM &INPUT_TABLES
    WHERE &SECURITYCOND
    DATE_OF_PAYMENT BETWEEN :START_DATE AND :END_DATE
    ORDER BY LOCATION_1, CPO_CHECK_NBR
    As you can see, this is both much easier to write and covers the possibility of expansion of paycodes (expansions always fit in these defined ranges).
    My question is, then, is it possible to write something like this in SQL and, if so, could you give me some sample code? (I'm one of those people who learn best from looking at the code as opposed to a set of instructions)

    Here is one way you could do it.
    Create a table that has columns like:
    Payment_code varchar2(2),
    Effective_Date Date,
    Payment_type varchar2(20),
    Expiration_Date Date)
    Payment type for example could be
    I- indemnity
    M- medical
    R- recovery
    E- expenses
    Let the table name for example be PAYMENT_CODE.
    The select query would look like
    SELECT ACCOUNT_NAME,
    LOCATION_1,
    CLMNT_LAST_NAME,
    CLAIM_NBR,
    DATE_OF_INJURY,
    DATE_CHECK_REGISTER,
    PAYEE_NAME_1,
    PAYMENT_CD,
    SERV_OFC,
    CPO_CHECK_NBR,
    PAYMENT_FORM,
    DECODE(p.payment_type,'E',PAYMENT_AMOUNT,0) expenses,
    DECODE(p.payment_type,'I',PAYMENT_AMOUNT,0) indemnity,
    DECODE(p.payment_type,'M',PAYMENT_AMOUNT,0) Medical,
    DECODE(p.payment_type,'R',PAYMENT_AMOUNT,0) recoveries,
    DECODE(PAYMENT_FORM, 'N', PAYMENT_AMT, NULL) NONCASH
    FROM &INPUT_TABLES,
    PAYMENT_CODE P
    WHERE P.PAYMENT_CODE = SOMEINPUT_TABLE.PAYMENT_CODE
    and other conditions
    The idea is to group all the payment codes into a few groups to reduce the clutter. If there is ever a change to the payment code, you could modify the table and it will be reflected in your select query.

  • Advantages of using Oracle with Unix over Windows server

    Hi there,
    I want some article/document which depicts the advantages of using Oracle with Unix (say HP-UX or Solaris backend). Actually the plan is to use some Data Warehousing applications using Cognos Poweplay, ReportNet and either Decision Stream of Cognos or Oracle Warehouse builder may be used as ETL tool. For Data mining applications we are planning to use SPSS Clementine. The Data volume will be substantial one. At present we are developing some prototype in Windows 2003 advanced environment. We are plaiing to use Risc server and RAID-5. Pl. advice some ideal architecture for us, as you know, it's typically a Govt. level application data (mostly archival data). The reports will be published using Report Net, Adhoc query etc, OLAP analysis will be done using Powerplay.
    Regards,
    Anupam Basu

    Hi there,
    I want some article/document which depicts the advantages of using Oracle with Unix (say HP-UX or Solaris backend). Actually the plan is to use some Data Warehousing applications using Cognos Poweplay, ReportNet and either Decision Stream of Cognos or Oracle Warehouse builder may be used as ETL tool. For Data mining applications we are planning to use SPSS Clementine. The Data volume will be substantial one. At present we are developing some prototype in Windows 2003 advanced environment. We are plaiing to use Risc server and RAID-5. Pl. advice some ideal architecture for us, as you know, it's typically a Govt. level application data (mostly archival data). The reports will be published using Report Net, Adhoc query etc, OLAP analysis will be done using Powerplay.
    Regards,
    Anupam Basu

  • Problem in SQL with CURSOR( ) ,Why the CURSOR did not work?

    hi All:
    I have a problem in SQL with CURSOR.
    The data is as the attachments.
    Here is the SQL statement as follow:
    SELECT A.WADCTO,A.WADOCO,B.IGCOST,CURSOR (SELECT X.IGLITM
    FROM F3102 X
    WHERE X.IGDOCO=A.WADOCO
    AND X.IGCOST IN ('B1','D1','C3')) AS DETAIL
    FROM F4801 A INNER JOIN F3102 B ON A.WADOCO=B.IGDOCO AND A.WADCTO=B.IGDCTO AND B.IGCOST>' '
    WHERE A.WADOCO='10004'
    The statement above returns records as follow:
    WADC WADOCO IGCOST DETAIL
    WO 10004 A1 CURSOR STATEMENT : 4
    CURSOR STATEMENT : 4
    IGLITM
    1KV90CPG2
    1KV90CPG2
    1KV90CPG2
    But, after I add one statement in the subquery, there is no record returned from CURSOR.
    Here is the SQL statement:
    SELECT A.WADCTO,A.WADOCO,B.IGCOST,CURSOR (SELECT X.IGLITM
    FROM F3102 X
    WHERE X.IGDOCO=A.WADOCO
    AND X.IGCOST=B.IGCOST
    AND X.IGCOST IN ('B1','D1','C3')) AS DETAIL
    FROM F4801 A INNER JOIN F3102 B ON A.WADOCO=B.IGDOCO AND A.WADCTO=B.IGDCTO AND B.IGCOST>' '
    WHERE A.WADOCO='10004'
    The statement above returns records as follow:
    WADC WADOCO IGCOST DETAIL
    WO 10004 A1 CURSOR STATEMENT : 4
    CURSOR STATEMENT : 4
    no rows selected
    Why the CURSOR did not work?
    The database version is Oracle Database 10g Release 10.2.0.4.0 - 64bit Production.
    F3102 DATA:
    IGDOCO     IGDCTO     IGLITM     IGCOST
    10004     WO     1KV90CPG2      A1
    10004     WO     1KV90CPG2      B1
    10004     WO     1KV90CPG2      C3
    10004     WO     1KV90CPG2      D1
    F4801 DATA:
    WADCTO     WADOCO
    WO     10004
    Edited by: user2319139 on 2010/3/2 上午 1:17
    Edited by: user2319139 on 2010/3/2 上午 1:20

    Why this structure and not a join?
    The cursor() function returns a cursor handle that needs to be processed - in other words, the client needs to fetch data from it. The Oracle® Database SQL Reference+ (http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/expressions005.htm#i1035107) describes it as being equivalent to a ref cursor handle.
    Thus why are you creating ref cursor handles as a column in a SQL projection - where each row will have a "+nested+" ref cursor handle to process. What problem are you attempting to hack solve this way?

  • How to reduce different versions of SQL with bind variables

    There is an application, developed on Java.
    Application executes SQL following types:
    select * from t where id in (:1)
    select * from t where id in (:1, :2)
    select * from t where id in (:1, :2, :3)
    select * from t where id in (:1, :2, :3, :4)
    ...And as a result very many versions (thousands) of similar SQL.
    Do you know a method to reduce number of such SQLs?
    I see one method: use one form of SQL with large number of prepared bid variables.
    Like as
    select * from t where id in (:1, :2, :3, :4, :5, :6, :7, :8, ...);And if query will be executed with one variable, the others will be equal to null.
    Is there another method?

    Cannot you insert those values into a temporary table and work within a subquery against that table ? That will make the code more secure, especially if the number of values is high.
    Nicolas.

  • NVL in where clause not working with UNIX parameters

    Apparently this in a where clause does not work in UNIX scripts...
    .... and trans_date between to_date('&1','YYYY/MM/DD HH24:MI:SS')
    and to_date(NVL('&2','31-DEC-4712'),'YYYY/MM/DD HH24:MI:SS')
    and to_date(NVL('','31-DEC-4712'),'YYYY/MM/DD HH24:MI:SS')
    ERROR at line 14:
    ORA-01858: a non-numeric character was found where a numeric was expected
    How do I get around a null in UNIX? This works fine if both parameters are populated. Thanks.

    Jason ORCL wrote:
    Apparently this in a where clause does not work in UNIX scripts...
    .... and trans_date between to_date('&1','YYYY/MM/DD HH24:MI:SS')
    and to_date(NVL('&2','31-DEC-4712'),'YYYY/MM/DD HH24:MI:SS')
    and to_date(NVL('','31-DEC-4712'),'YYYY/MM/DD HH24:MI:SS')
    ERROR at line 14:
    ORA-01858: a non-numeric character was found where a numeric was expected
    How do I get around a null in UNIX? This works fine if both parameters are populated. Thanks.it's nothing to do with unix at all - your date value doesn't match the format mask that you've entered:
    '31-DEC-4712' doesn't map to 'YYYY/MM/DD HH24:MI:SS' in any universe unfortunately.

  • Schedule workbook using with Unix shell script

    Hi,
    Can we schedule workbook using with Unix shell script?
    Thanks,
    Jay

    I can't imagine how.
    1. You can schedule Disco workbooks via Disco itself.
    2. You can schedule Disco workbooks to run and output in different file formats automatically via batch scheduler in Windows running Disco Desktop directly (or can user VBasic).
    3. You can schedule Disco workbooks to run and output in different file formats automatically via a Java program running the Java Command Line interface.
    Moving forward, Oracle has announced that with a further interfacing of Disco with XML Publisher, you'll be able to use Oracle Apps concurrent manager and scheduling. But that's coming supposedly at the end of this year.
    And I think that's about it.
    Russ

  • Integrating PL/SQL with Perl

    Hello All,
    I have just started learning PL/SQL and this my first R&D stuff with PL/SQL :)
    I have a very basic beginner question.
    Suppose I want to insert 1 lakh rows in a table through Perl. One and easiest way to do is to prepare and execute insert queries using Perl module - 'DBI' module in a loop
    But I guess this will send lot of traffic over the LAN. What I rather feel is that if I execute these 1 lakh SQL queries using PL/SQL it will be comparatively more network efficient and fast.
    So I have following questions:
    1. Is it possible to integrate PL/SQL with Perl using 'DBI' module
    2. Is there a way in PL/SQL that it will return status of all the 1 Lakh SQL queries after execution that will let me know which SQL queries were successfully executed and which failed.

    1. Is it possible to integrate PL/SQL with Perl using 'DBI' moduleyes, just use a PL/SQL statement instead of a sql one
    2. Is there a way in PL/SQL that it will return status of all the 1 Lakh SQL queries after execution that will let me know which SQL queries were successfully executed and which failed.yes, you have to manage an exception block for each row and store the single row result in a cumulative variable:
    The following code is an incomplete and not testet example:
    my $STM = "
    declare
    ret varchar2(10);
    begin
      begin
        insert into mytab values(1);
        ret := ret||'0';
      exception
        when others then
          ret:=ret||'1';
      end;
      begin
        insert into mytab values(2);
        ret := ret||'0';
      exception
        when others then
          ret:=ret||'1';
      end;
    ... and so on ...
      select ret into :OUTRES from dual;
    end;";
    my $outres;
    my $hnd = $db->prepare($STM);
    $hnd->bind_param_inout( ":OUTRES", \$outres, 10);  -- 10 is the variable length, e.g. the number of inserts
    $hnd->execute();
    print "inserts output: $outres\n";At the end of the script you should hava a string of bits. A 0 for each successful insert an 1 for each unsuccessful...
    Max
    [My Italian Oracle blog|http://oracleitalia.wordpress.com/2010/01/10/crittografia-in-plsql-utilizzando-dbms_crypto/]

  • Learning PL/SQL with SQL plus

    I'm looking to teach myself PL/SQL with SQL Plus, it's a works pc so I can not use any other software than SQL plus.
    When starting SQL plus I'm asked for a username, password and host string.
    I'm taking it the host string is the db I want to connect to and obviously supply the username and password for level of access?
    Also what I ideally need is a sample db on my local machine to connect to with SQL plus to learn that way.
    Can anyone point me in the right direction please. Any help is greatly appreciated.

    Use the net8 configuration assistant preferably as it'll get the syntax correct.
    Otherwise you copy the sample one up one folder and edit that.
    Connection information (SID, Server/IP, port number) you'll have to get off your DBA.
    The name at the start of a tnsnames entry is the name that you want to reference the database as, so you can call it FRED if you like.
    e.g.
    FRED =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS =
            (PROTOCOL = TCP)
            (HOST = <server name or ip address>)
            (PORT = <port>) -- usually 1521 but can differ if more than one instance on the server
        (CONNECT_DATA =
          (SID = <database SID>) -- the name of the database on the server.
      )Once that's set up you can then log onto the database in the following way:
    sqlplus <user>/<password>@fred
    What happens is that the TNS Listener service (that should be running on your PC) will look up "fred" in the tnsnames.ora file and then use the information from that to make the connection to the server on the correct port and connect you to the actual database on there.
    After that.... it's up to you.
    :)

Maybe you are looking for