Debugging procedure or packages using sql*plus reg

Dear all,
I am new to oracle, can any body provide me some information related to this below issues.
a) suppose i have created a procedure using sql*plus tool then next day i wanted to debug or modify my stored procedure.
Then what could approach using sql*plus
b) same case if we consider for packages then for any specific stored procedure or functions what would be the approach to debug or modify using sql*plus
yours cordination will be highly appreciate
Thanks n regards
Laxman

Using SQL*Plus you can debug your stored pl/sql code only adding some "prints" in your code:
SQL> create or replace procedure test is
  2  begin
  3  dbms_output.put_line('starting...');
  4  --do something here
  5  dbms_output.put_line('done step 1');
  6  --do something else here
  7  dbms_output.put_line('end procedure...');
  8  end;
  9  /
Procedura creata.
SQL> set serverout on
SQL> exec test
starting...
done step 1
end procedure...
Procedura PL/SQL completata correttamente.Or writing logs in a log table:
SQL> create table logtab(ts timestamp(9),mess varchar2(4000));
Tabella creata.
SQL> create or replace procedure test is
  2  begin
  3  insert into logtab values(systimestamp,'starting...');
  4  --do something here
  5  insert into logtab values(systimestamp,'done step 1');
  6  --do something else here
  7  insert into logtab values(systimestamp,'end procedure...');
  8  end;
  9  /
Procedura creata.
SQL> exec test
Procedura PL/SQL completata correttamente.
SQL> col ts for a40
SQL> col mess for a40
SQL> select * from logtab;
TS                                       MESS
25-DIC-09 15:33:13,656000000             starting...
25-DIC-09 15:33:13,656000000             done step 1
25-DIC-09 15:33:13,656000000             end procedure...Max
[My Italian Oracle blog|http://oracleitalia.wordpress.com]

Similar Messages

  • Help Using SQL*Plus Format Commands (like TTITLE) in Packages

    Where (within a package) can/should SQL*Plus format commands such as TTITLE, COLUMN & BREAK be coded?

    A package is coded in PL/SQL.
    TTITLE, COLUMN and BREAK are SQL*Plus commands, they cannot be used in PL/SQL.
    If you want to output data (using dbms_output) in your package, you'll have to implement the features yourself. But probably just using SQL*Plus is better in your case.
    Regards,
    Rob.

  • Create database table using Forms Developer 6/6i without using SQL*Plus

    hello there,
    I need help in creating tables in Oracle using Forms Developer 6/6i without using SQL*Plus interface.
    your help is appreciated
    email: [email protected]

    please use Forms_ddl package to create a table dynamically
    from the Developer6/6i.
    you can check the success or failure by using the
    form_success builtin.
    if u want to avoid using the Forms_ddl package
    use stored procedure or create a sql querry record group.
    regards
    sriram.

  • Creating a package in sql*plus

    Dear all;
    Do you know what is wrong with this statement
    SQL> create or replace pkg_initial_comment as procedure save_initial_comment(p_i
    d number, p_first_name varchar2, p_last_name varchar2, p_comment varchar2, p_dat
    e date); end save_initial_comment; create or replace package body pkg_initial_co
    mment as procedure save_initial (p_id number, p_comments varchar2, p_first_name
    varchar2, p_last_name varchar2, p_date date) is begin insert into initial_commen
    ts values (1, p_first_name, p_last_name, p_comment, sysdate); end save_initial;
    end pkg_initial_comment;
    create or replace pkg_initial_comment as procedure save_initial_comment(p_id num
    ber, p_first_name varchar2, p_last_name varchar2, p_comment varchar2, p_date dat
    e); end save_initial_comment; create or replace package body pkg_initial_comment
    as procedure save_initial (p_id number, p_comments varchar2, p_first_name varch
    ar2, p_last_name varchar2, p_date date) is begin insert into initial_comments va
    lues (1, p_first_name, p_last_name, p_comment, sysdate); end save_initial; end p
    kg_initial_commentI keep getting the following error message
    ora-00922:
    and my table structure is below
    create table initial_comment (id number(30),
    first_name varchar2(4000), last_name varchar2(4000), create_date date);

    yeah I just realized all my problems, it wasnt just the package keyword, it was also the names were wrong in both the specification and body. I am not used to using sql*plus, i use all other client tools which gives an opportunity to see and understand my syntax clearly. sorry about the posting and formatting. thanks for the help

  • Can v read a client text file using SQL*plus??

    We have a requirement like this: We need to read a text file to find spelling mistakes. Problem is the file has to be always moved to the DB machine, which is a Linux box and then run a stored procedure which uses UTL_FILE. Now in order to show the spelling mistakes of the file the user will have to again copy the file with the spelling mistakses (output file) from Linux to Windows.
    Is there a way to do it using SQL*Plus, where the text file is in the client machine???? Then users don't have to copy the file to and from the Linux box.

    SQL*Plus is a client software and whatever code you write using SQL*Plus, it ultimately run on the server. So the answers to your question is "no".

  • Cannot connect to database using SQL*Plus

    Hi, I have Oracle 10g XE installed in my labtop and I cannot connect using SQL*Plus.
    I can connect using the broser User Interface though, which I was able to do after doing the following procedure to change the password of the sys account:
    -     open a command prompt
    -     - type sqlplus
    -     On the “Enter user-name” line, type /as sysdba
    -     On the SQL> prompt, type alter user sys identified by NewPassword;
    But the thing is that even though I am able to connect using sys/NewPassword from my browser UI, I dont get the same result when doing it using the SQL prompt.
    What I am trying to do is this:
    SQL> connect sys/NewPassword
    Then I get first a warming saying that I need to use either sysdba or sysoper to connect to the system account, but neither of those work.
    Can anyone advice me on this matter?
    Thanks in advance

    Thanks for that.
    I run the command to list the usernames on the database and I got SYS and SYSTEM in the list. But again, when I try to use SYS with a password that I know is working because I can access it through the browser UI, it doesnt work. It seems like this sys is different to the sys I used in the UI.
    I dont know if I am explaining myself correclty... In the Browser UI I use sys, and a password and I get connected to the sys account. However, if I try to use the same sys.password combination from my sqlplus prompt, I get error messages
    Does this make sense at all?

  • Modifying Stored Procedue Using SQL Plus

    Can you modify an existing procedure using SQL Plus?

    you can write your own "editor"
    editproc.sql
    set feedb off echo off termout off head off trimsp on lin 10000 pages 0
    spool tmpproc.sql
    select dbms_metadata.get_ddl('PROCEDURE','&1') p from dual;
    spool off
    get tmpproc nolist
    ed
    set feedb 6 termout on
    /than, to edit procedure P in sqlplus
    SQL> @editproc P
    (... edit it ...)Procedure created.
    SQL>

  • Issue during Running Package using Sql Agent

    hi all
    I have an issue  when I deployed Package and Run package using sql agent.
    before a Successfully Run Package without Any error. but in job It gives me error.
    Executed as user: abc\sqlserver. Microsoft (R) SQL Server Execute Package Utility  Version 10.50.4000.0 for 64-bit  Copyright (C) Microsoft Corporation 2010. All rights reserved.    Started:  08:28:11  Error: 2014-02-12
    08:28:11.86     Code: 0xC0016016     Source:       Description: Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified
    state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that the correct key is available.  End Error  Error: 2014-02-12 08:28:11.97     Code: 0xC0202009    
    Source: PAckageNameReport Connection manager "....................."     Description: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E4D.  An OLE DB record is available. 
    Source: "Microsoft SQL Server Native Client 10.0"  Hresult: 0x80040E4D  Description: "Login failed for user .....".  End Error  Error: 2014-02-12 08:28:11.97     Code: 0xC020801C    
    Source: Import into Excel OLE DB Source [1]     Description: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER.  The AcquireConnection method call to the connection manager "....................." failed
    with error code 0xC0202009.  There may be error messages posted before this with more information on why the AcquireConnection method call failed.  End Error  Error: 2014-02-12 08:28:11.97     Code: 0xC0047017    
    Source: Import into Excel SSIS.Pipeline     Description: component "OLE DB Source" (1) failed validation and returned error code 0xC020801C.  End Error  Error: 2014-02-12 08:28:11.97     Code: 0xC004700C    
    Source: Import into Excel SSIS.Pipeline     Description: One or more component failed validation.  End Error  Error: 2014-02-12 08:28:11.97     Code: 0xC0024107     Source: Import into Excel     
    Description: There were errors during task validation.  End Error  DTExec: The package execution returned DTSER_FAILURE (1).  Started:  08:28:11  Finished: 08:28:11  Elapsed:  0.14 seconds.  The package execution failed. 
    The step failed.
    I'm using Sql Authentication.
    Kindly Help.
    thanks

    Hi BI_group,
    According to the error message, the issue may occur due to two possible reasons: protection level of the package or the 32-bit/64-bit driver issue.
    For the first possible reason, it may be that package still uses the default protection level EncryptSensitiveWithUserKey after it is deployed, however, the SQL Server Agent job runs under a different user account. To avoid the issue, you can re-deploy the
    package and set the package protection level to EncryptSensitiveWithPassword or DontSaveSensitive during the deployment. If it is set to EncryptSensitiveWithPassword, we need to configure the Execution options of the job step to use the
    /decrypt password option in the DTexec utility command line to decrypt the encrypted data. If the package is deployed to the SQL Server or SSISDB catalog, we can set the protection level to Rely on server storage for encryption or ServerStorage.
    If it is not the case, check whether it is caused by the 32-bit/64-bit driver issue. For a 64-bit SSIS server, it uses 64-bit drivers by default, however, BIDS/SSDT uses 32-bit drivers unless the Run64BitRuntime property of the IS project is set to true.
    In the BIDS/SSDT, check the Run64BitRuntime property to see if it runs in 32-bit or 64-bit runtime. This enable us to judge whether we need to check the “Use 32 bit runtime” option for the job step.
    Regards,
    Mike Yin
    TechNet Community Support

  • Inserting Special Character using SQL*Plus

    I am trying to insert special character like ® using SQL*Plus but it is inserting a .(dot) instead.
    Environment:
    Oracle Enterprise version : 9.2.0.3.0
    Sun Solaris 8
    Any help will be appreciated.
    Regards,
    Nirmalya

    That's the reason I use ASCII values always for special characters.
    SQL> create table sample1(col1 varchar2(50))
      2  /
    Table created.
    SQL> insert into sample1
      2  select 'The temperature outside is 20'||chr(176)||' centigrade' col1
      3  from dual
      4  /
    1 row created.
    SQL> commit
      2  /
    Commit complete.
    SQL> select * from sample1
      2  /
    COL1
    The temperature outside is 20° centigrade
    1 row selected.
    SQL> drop table sample1 purge
      2  /
    Table dropped.
    SQL> Cheers
    Sarma.

  • 11g: can connet using SQL*PLUS, not with TOAD

    Hi
    I run into a problem with TOAD. I can't connect with my 11g database using TOAD. I don't get any messages it just gives me a little waiticon for a split second and then nothing happens. I can however connect to my 10g database using TOAD. Using SQL*Plus I can connect to both.
    I use TOAD 8.6. Do I need a newer version maybe??...

    I can connect like:
    hr/pw@xe
    or
    hr/pw@O11R1
    or directly, no problem. I can connect from SQLplus to both databases any way I want

  • Can I use SQL *Plus 11.1.0.7.0 to connect Oracle Express 10g

    Hi guys:
    I download "Oracle 11g ODAC *11.1.0.7.20* with Oracle Developer Tools for Visual Studio", trying to use SQL *plus to see if configuration is alright.
    But after entering account/pwd, I got a error:
    ORA-12560: TNS:protocol adapter error
    What is wrong with my environment?
    Thanks,
    Ricky

    user12086319 wrote:
    Hi EdStevens,
    Following the instructions in previous post, I can connect with SQL plus (the database is on the same box* as your sqlplus client); I just enter sqlplus in windows console.
    In addition, i am still curious about how SQL plus connect to a remote* box. Could you shed more light on that?SQLPlus connects to a remote db the same way any other app does. After all, sqlplus is just another client app.
    It's all in the connect string. So say, at a command prompt you enter
    $> sqlplus scott/tiger@mydbso in the above example, 'scott' is the user, 'tiger' is the password, and 'mydb' is the tns service name. Of course, the OS passes all that to sqlplus as a command line parameter. Internally, sqlplus makes a call to the tns layer and passes it the connect information it has. TNS will take a look at the tnsnames.ora file and find an entry for 'mydb', and from there it will get the name or ip address of the host server, a port number, and a service name. That information will be passed on down the network stack for routing. (If a name was provided instead of an ip address, the OS network stack will use whatever means are at its disposal - a hosts file, a dns lookup, or whatever, to get an ip address). The request will arrive at the specified host and placed on the specified port. If everything was configured correctly, there will be an oracle listener process monitoring that port. It will pick up the request and see if it recognizes the service name. If it does, it will spawn a user server process on a different port to complete the connection, then get out of the way and continue listening for more requests.
    This is how it happens most of the time. There are a lot of other variants, but that's the gist of it.
    More information can be found in the fine documentation at tahiti.oracle.com.

  • Listener is listening but when we use sql*plus ORA-12203

    Hi all,
    listener is listening but when we use sql*plus ORA-12203
    we are trying to connect oracle database in VPN, all the configuration is ok, the listener is listening at db-server site with 1521
    we can connect with tnsping, but when we connect with
    sqlplus it not going through. any boidy has experienced this. any one can help?
    Thanks in advance

    TNSNAMES.ORA file is
    it works when i try with serice name factory through LAN, then im disconnectinag at LAN and try through VPN, it doesnt go.
    here is TNSNAMES.ORA copy .
    Beq-local.world =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS =
    (COMMUNITY = beq.world)
    (PROTOCOL = BEQ)
    (PROGRAM = oracle73)
    (ARGV0 = oracle73ORCL)
    (ARGS = '(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))')
    (CONNECT_DATA = (SID = ORCL)
    Tcp-loopback.world =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS =
    (COMMUNITY = tcp.world)
    (PROTOCOL = TCP)
    (Host = 127.0.0.1)
    (Port = 1521)
    (CONNECT_DATA = (SID = ORCL)
    Example1.world =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS =
    (COMMUNITY = tcp.world)
    (PROTOCOL = TCP)
    (Host = Production1)
    (Port = 1521)
    (CONNECT_DATA = (SID = SID1)
    Example2.world =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS =
    (COMMUNITY = spx.world)
    (PROTOCOL = SPX)
    (Service = Server_lsnr)
    (CONNECT_DATA = (SID = ORCL)
    Example3.world =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS =
    (COMMUNITY = nmp.world)
    (PROTOCOL = NMP)
    (Server = FinanceServer1)
    (Pipe = ORAPIPE)
    (CONNECT_DATA = (SID = ORCL)
    factory =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS =
    (COMMUNITY = tcp.world)
    (PROTOCOL = TCP)
    (Host = DBSERVER)
    (Port = 1521)
    (CONNECT_DATA = (SID = MYDATABASE)
    factory1 =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS =
    (COMMUNITY = tcp.world)
    (PROTOCOL = TCP)
    (Host = 172.27.32.22)
    (Port = 1521)
    (CONNECT_DATA = (SID = MYDATABASE)
    )

  • Using sql*plus to login to oracle 9i

    I have installed Oracle 9i for windows and am trying to login using SQL*PLUS
    user: system
    pwd: manager
    Host String: BHURU
    It says TNS could resolve service name.
    I have all the services running in the admin monitor.
    Am I missing something?

    This is not a right forum to post your problem. This is SQL PL/SQL forum.
    Please post it in Database General Forum.
    Regards.
    Satyaki De.

  • Calling SQL scripts from subdirectories using SQL*Plus 9.2.0.1

    Is it possible to run an SQL script that in turn calls other SQL scripts from subdirectories? This seemed to work fine using SQL*Plus 8.1.7
    Did it break in 9.2.0.1?
    Any fixes available?

    Ryan,
    What exactly is your problem? Can you tell me any errors you are seeing? Platform?
    Alison

  • Logging into ORACLE 9I using SQL*PLUS.TNS Error

    I have installed Oracle 9i for windows and am trying to login using SQL*PLUS
    user: system
    pwd: manager
    Host String: BHURU
    It says TNS could resolve service name.
    I have all the services running in the admin monitor.
    Am I missing something? Please advise.

    Can you post your tnsnames.ora file contents and listener.ora contents here?
    There may be tons of things wrong with the error actually,
    ORA-12154:     TNS:could not resolve the connect identifier specified
    Cause:     A connection to a database or other service was requested using a connect identifier, and the connect identifier specified could not be resolved into a connect descriptor using one of the naming methods configured. For example, if the type of connect identifier used was a net service name then the net service name could not be found in a naming method repository, or the repository could not be located or reached.
    Action:     
    - If you are using local naming (TNSNAMES.ORA file):
    - Make sure that "TNSNAMES" is listed as one of the values of the NAMES.DIRECTORY_PATH parameter in the Oracle Net profile (SQLNET.ORA)
    - Verify that a TNSNAMES.ORA file exists and is in the proper directory and is accessible.
    - Check that the net service name used as the connect identifier exists in the TNSNAMES.ORA file.
    - Make sure there are no syntax errors anywhere in the TNSNAMES.ORA file. Look for unmatched parentheses or stray characters. Errors in a TNSNAMES.ORA file may make it unusable.
    - If you are using directory naming:
    - Verify that "LDAP" is listed as one of the values of the NAMES.DIRETORY_PATH parameter in the Oracle Net profile (SQLNET.ORA).
    - Verify that the LDAP directory server is up and that it is accessible.
    - Verify that the net service name or database name used as the connect identifier is configured in the directory.
    - Verify that the default context being used is correct by specifying a fully qualified net service name or a full LDAP DN as the connect identifier
    - If you are using easy connect naming:
    - Verify that "EZCONNECT" is listed as one of the values of the NAMES.DIRETORY_PATH parameter in the Oracle Net profile (SQLNET.ORA).
    - Make sure the host, port and service name specified are correct.
    - Try enclosing the connect identifier in quote marks. See the Oracle Net Services Administrators Guide or the Oracle operating system specific guide for more information on naming.
    HTH
    Aman....
    Edited by: Aman.... on Oct 7, 2008 5:46 PM
    Added error info

Maybe you are looking for

  • Some photos don't open in edit

    Some of my photos won't open in edit. When I try to do this I get a grey screen with a question mark in the middle. Also, other photos will open but they are not enlarged in the edit window. Still others work in edit fine. There is no rhyme or reason

  • Facetime is missing once i restored from backup.

    I just got my new iphone4, when i don't restored backup from my old iphone3g, it will have the facetime settings but once i restored the old backup into the phone, there will not have the facetime settings at all in the settings.. KIndly help me.. Th

  • How to get query from a record group

    HI do we get the query from which record groupis based on in oracle forms with out checking in to the properties.

  • HT5361 How to move saved messages in outlook to mail

    Could someone tell me how I can move all my saved messages from my Outlook into my mail as I wish to only use mail in future. Many thanks

  • Fpga cannot install software !!

    I need help because I'm not able to install software on my cRIO and I really don't have any idea.  When I try to do "add/remove software" a window with written "The selected target does not support this function" appears. I tried to format it. So now