PL/SQL test

I just want to add one line in my PL/SQL code what display a notice, Can any body forward me the key words from where i can get help, second how i can test that PL/SQL which i write.
Waiting for help.
Arif

you can use DBMS_OUTPUT.PUT_LINE() to display the output.
example:
DBMS_OUTPUT.PUT_LINE('hello world');you must first type in the SQL*Plus command line:
SET SERVEROUTPUT ON;to run your PL/SQL script at the SQL*Plus:
SQL> @yourscript.sql;Message was edited by:
Warren Tolentino
sorry kamal while posting this you had already posted a samples.

Similar Messages

  • Could someone provide the link to where the SQL test can be taken online ?

    Good morning,
    Apologies for the lame question. I did search!
    I read in another thread in this forum the following:
    >
    The SQL test you can take online, which should allow you to take it as soon as you're ready.
    >
    After some googling and looking around in the Oracle web site. I can't find the page where the SQL test can be taken.
    If someone would be so kind to provide the link, I'd very much appreciate it.
    Thank you.
    John.

    Hi John,
    440bx - 11gR2 wrote:
    I read in another thread in this forum the following:
    >
    The SQL test you can take online, which should allow you to take it as soon as you're ready.
    >
    After some googling and looking around in the Oracle web site. I can't find the page where the SQL test can be taken.
    If someone would be so kind to provide the link, I'd very much appreciate it.In regards with the above I can just say that, 'online' perahps meant that the exam is computer-based which can be taken from any PV centre or at Oracle centre. That is what I know about the exam coz I don't think you can take exam from home as Oracle/PV is very strict regarding their policies to avoid any case of cheating and doesn't allow the candidates to carry anything, including wallet while taking exam at any PV centre.
    Regards,
    Sree

  • Hi Experts... (problem with for do an SQL test)

    Hi people,
    I need to do a SQL test in production Environment. I must optimize a SQL statement like "SELECT field_name FROM table_name.". Normally, I'm doing yhis process:
    1. I make a  Z program, with the SQL statement.
    2. I upload the program to Test environment.
    3. Finally, I upload the program to Production Environment an Test it.
    I understand that this is a long way to do test (I think).
    Can someone help me with another idea?
    Thanks!

    Hi friend,
    This question is linked with SQL test issue.
    I 've this SQL sentence:
      DATA: it_ges LIKE zcctbltar OCCURS 0 WITH HEADER LINE.
      CONSTANTS: l_c_si(2) TYPE c VALUE 'SI'.
      SELECT zmandt zguid_oportunidad zgestor ztipo1 z~tipo2
              ztipo3 zestatus zprioridad zcliente
      APPENDING TABLE it_ges_
      FROM ( zcctbltar AS z INNER JOIN crmd_orderadm_h AS c
             ON zguid_oportunidad = cguid )
      WHERE z~tipo2 = 'ZAP'
      AND c~zztexto27 = l_c_si.
      This sentence needs  6,5 Seconds in INTEGRATION environmet (ZCCTBLTAR have 39.882 items, CRMD_ORDERADM_H have 1.853.334 items).
    The problem is that I need do this process more fast than actually. In PRODUCTION environment, We have 3.179.867 items in CRM_ORDERADM_H (double than INTEGRATION).
    ¿Do U know how optimize this SELECT?
    Thanks,
    Sergio

  • Need tools info. on SQL test data preparation

    Hi,
    I need to prepare large volume of data's for the testing's.
    For example,
    There is a need to insert some 500 numbers into a table.
    Instead of writing the sql insert statements, procedures, using sql developers etc...
    Is there any tools available for this to prepare the data's like this..
    The tools has to be more generic for any type of the SQL statement requirements
    for the testing.
    Thanks,
    Kar.

    Are you looking for a test data generator, or just a quick way to load data?
    For test data generators, try this, for a quick way to load data use [SQLLoader |http://download.oracle.com/docs/cd/B28359_01/server.111/b28319/part_ldr.htm#i436326]. This is the 11g documentation, you should be able to find the 10g documentation easily enough.
    Note that this forum is specifically for the SQLDeveloper tool. You may get better answers in the [Database General|http://forums.oracle.com/forums/forum.jspa?forumID=61] forum.
    Edited by: Jim Smith on Oct 4, 2008 10:45 AM

  • Unable to register PL/SQL test in Diagnostics

    Hi all
    I try to register a new test in Diagnostics Dashboard with a PL/SQL procedure test template, but Still get error
    XML File Name: /home/weibxia/Diagnostics/PlsqlDiagnosticTestTemplate.xml
    Status: Failed
    Reason: The PL/SQL procedure 'FUSION.FND_DIAG_DEMO_TESTS.DEMO_TEST_1_RUN_TEST' is either not defined or is defined with one or more formal parameters when it should have none.
    Also I follow the steps:
    grant EXECUTE on fusion.FND_DIAG_DEMO_TESTS to fusion_runtime;
    grant EXECUTE on fusion.FND_DIAG_DEMO_TESTS to FUSION_APPS_EXECUTE;
    The problem still can not be resolved. Please help me about that.
    Thanks.

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by prashant Sahoo ([email protected]):
    Hello Sir,
    As per you , I compiled everything in Windows NT. And when I ran it on windows NT it works fine. But when I tried to run the same in Unix server (where the production Report Server 6i is installed) by ftp the RDF file and PLL file to bin directory in binary mod and tried to run from a remote client thru command line syntax it gives me the above error again. Please help me out.
    Prashant<HR></BLOCKQUOTE>
    null

  • MS sql test converted to long and job log states that 1 row read at time

    I am going from ms sql to ms sql server. The source text datatype is being covnerted to a long. No problem there. However, when the job runs, there is a warning: Rows per committ has been reset to 1 because table conatins a long column.
    11.7 of DI
    How can I get around this?

    Michael,
    This is indeed a limitation in the DI 11.7 (and earlier) releases which might result in a slower performance when loading data with long or CLOB datatypes.
    In DI XI 3.0 (or version 12.0) we significantly improved the large object support. Main improvements were supporting BLOB (in addition to CLOB), extending support to more BLOB/CLOB datatypes for all databases and an optimized intermediate storage of the large objects. Removing the commit=1 restriction was a side effect of these optimizations.
    Ben.

  • Sql practice exams, tests, help!

    Hello,
    Does anyone have practice questions for 1Z0-001 SQL test (OCP) ? If you have, can you send me it to the following e-mail: [email protected] !
    Any help would be great!
    thank you,
    Zeljko

    Hi,
    Methink you'll be getting more than just exam questions on your email from now on.
    Have you googled for '1Z0-001'? I get lots of hits for practice exams. Of course, you'll have to pay for them. But since you're doing an OCP you're prepared to pay anyway.
    Cheers,
    Colin

  • ORA-00604: error occurred at recursive SQL level 1 ORA-01882: timezone

    Hi
    I'm trying to config my base_domain for SOA11g but i'm getting the following error when connecting to my Oracle XE DB to configure SOA,
    please help thanks
    Software installed
    OS: Windows 7 64bit
    DB: Oracle XE 10g
    Oracle SOA 11.1.1.4.0
    Oracle RCU 11.1.1.4.0
    Oracle wls1034_generic
    Error Detials
    Component Schema=SOA Infrastructure
    Driver=oracle.jdbc.xa.client.OracleXADataSource
    URL=jdbc:oracle:thin:@127.0.0.1:1521/XE
    User=DEV_SOAINFRA
    Password=********
    SQL Test=select 1 from schema_version_registry where owner=(select user from dual) and mr_type='SOAINFRA' and version='11.1.1.4.0'
    ORA-00604: error occurred at recursive SQL level 1
    ORA-01882: timezone region  not found
    CFGFWK-60850:  Test Failed!
    Component Schema=User Messaging Service
    Driver=oracle.jdbc.OracleDriver
    URL=jdbc:oracle:thin:@127.0.0.1:1521/XE
    User=DEV_ORASDPM
    Password=********
    SQL Test=select 1 from schema_version_registry where owner=(select user from dual) and mr_type='ORASDPM' and version='11.1.1.2.0'
    ORA-00604: error occurred at recursive SQL level 1
    ORA-01882: timezone region  not found
    CFGFWK-60850:  Test Failed!
    Component Schema=OWSM MDS Schema
    Driver=oracle.jdbc.OracleDriver
    URL=jdbc:oracle:thin:@127.0.0.1:1521/XE
    User=DEV_MDS
    Password=********
    SQL Test=select 1 from schema_version_registry where
                        owner=(select user from dual) and mr_type='MDS' and
                        version='11.1.1.4.0'
    ORA-00604: error occurred at recursive SQL level 1
    ORA-01882: timezone region  not found
    CFGFWK-60850:  Test Failed!
    Component Schema=SOA MDS Schema
    Driver=oracle.jdbc.OracleDriver
    URL=jdbc:oracle:thin:@127.0.0.1:1521/XE
    User=DEV_MDS
    Password=********
    SQL Test=select 1 from schema_version_registry where owner=(select user from dual) and mr_type='MDS' and version='11.1.1.4.0'
    ORA-00604: error occurred at recursive SQL level 1
    ORA-01882: timezone region  not found
    CFGFWK-60850:  Test Failed!
    Component Schema=OSB JMS Reporting Provider
    Driver=org.apache.derby.jdbc.ClientDriver
    URL=jdbc:derby://127.0.0.1:1521/XE;create=true;ServerName=127.0.0.1;databaseName=XE
    User=DEV_SOAINFRA
    Password=********
    SQL Test=SELECT 1 FROM SYS.SYSTABLES
    Insufficient data while reading from the network - expected a minimum of 6 bytes and received only 0 bytes.  The connection has been terminated.
    CFGFWK-60850:  Test Failed!

    Hi,
    Please check the timezone set in your server where Weblogic is installed. Also ensure the timezone on which your weblogic is running, the same is present in in database by querying V$TIMEZONE_NAMES table. If it is not present then please change the timezone of the server. then try to execute the steps what you are doing, it will not throw any error.
    if this helps please mark.
    Thanks,
    Kishore

  • Is it possible to define default value of a variable in sql scripts

    Hi,
    I was thinking of a way to assign a default value to a variable without any prompt by the script as we do in shell script.
    To make my query more clear, consider the example.
    suppose we have a sql script like test.sql with contents
    ===========================================
    define x=&1
    declare
    x1 number;
    begine
    x1:=nvl(&x,10);
    dbms_output.put_line(x1);
    end;
    ===========================================
    even though I am using nvl it will prompt for value of 1 which needs user interference. for example if I run test.sql output is as below:
    =============
    SQL> @test
    Enter value for 1:
    10
    =============
    Is there any way to avoid sql from prompting for values of variables for which we want it to take a default value (if not specified as input argument)
    Thanks
    now if i run this as
    sql>@test 10
    it executes

    I wan't to accept the value as command line argument. say the whole statement is written into an sql file say test.sql so that &1 will hold any value specified as input.
    So the issue is although sql will execute the procedure if no value is specified but it will still prompt once for any variable (&x or &1). if you don't specify anything and just press enter than only the default value is taken.
    I wan't the script to be executed on cron without user interference. So, was looking if there's a way to specify default value for cron script.

  • How to print .sql file name in the same file using sqlplus

    Oracle 10g on Linux platform.
    I am trying to print the name of .sql script file in that file but could not. Following is the file:
    test.sql
    select '&0' from dual;But instead of printing, it is asking for input:
    SQL> @test.sql
    Enter value for 0: Can any body give me a hint as how can i print the file name.

    Use this
    SELECT FNAME_KRBMSFT AS name FROM X$KRBMSFT
    and see
    SQL> create or replace procedure get_dir_list
    2 (p_directory varchar2)
    3 is
    4 l_null varchar2(100);
    5 l_directory varchar2(100);
    6 BEGIN
    7 l_directory := p_directory;
    8 sys.dbms_backup_restore.searchfiles(l_directory, l_null);
    9 FOR x IN (select fname_krbmsft fname from x$krbmsft) LOOP
    10 dbms_output.put_line(x.fname);
    11 END LOOP;
    12
    13 END;
    14 /
    Edited by: HuaMin Chen on Jun 26, 2012 12:26 PM

  • How execute this stored procedure from SQL PLUS???

    Hello folks....
    Help me please...
    I have this procedure....
    CREATE OR REPLACE PROCEDURE TEST(COD OUT VARCHAR2, NUM OUT
    VARCHAR2, ID OUT VARCHAR2)
    AS
    BEGIN
    END;
    SO, I4D LIKE TO EXECUTE IT FROM SQL PLUS::
    BUT, I DONT KNOW HOW TO DO..PLEASE SEND ME A SAMPLE..
    THANK U

    Thank u man!!!
    look, my error before was :
    SQL> set serveroutput on
    SQL> declare
    SQL> cod varchar2(100);
    SQL> num varchar2(100);
    SQL> id varchar2(100);
    SQL> begin
    SQL> TEST( cod, num, id );
    SQL> EXEC DBMS_OUTPUT.put_line( cod || ' ' || num || ' ' ||
    id );
    SQL> end;
    SQL> /
    i put the EXEC....
    thank u!!!

  • Suppressing Substitution messages in SQL

    I have a SQL script which generates activity report for a user specified date. User inputs a date which is then stored in a variable. When this variable is substituted in a sql statement by its valus it displays message
    old: .......
    new: .......
    There must be a way to suppress this message so it will not appear within the report. Please help.
    Following is the script which user will invoke throug a menu menu outside of SQL:
    /*     test.sql     */
    prompt Enter a date in format YYYYMMDD (for example: 20030122)
    accept reqd_date number prompt 'DATE:>'
    select 'US ACTIVITY LOG REPORT FOR', to_char(&reqd_date) from dual;
    prompt =====================================
    prompt
    prompt USERID ID ACTIVITY COUNT
    prompt ------ -- -------- -----
    prompt
    break on userid
    select userid, us_id, type_of_activity, sum(number_records)
    from us_activity_log
    where to_char(start_time, 'YYYYMMDD') = to_char(&reqd_date)
    group by userid, us_id, type_of_activity;
    prompt
    prompt END OF REPORT

    set verify off;

  • Help Needed -- Oracle XML/SQL utility and PL/SQL parser

    Let's say we have an xml file
    <?xml version="1.0" standalone="no"?>
    <abc>
    <def>
    <ghi>test</ghi>
    </def>
    <jkl>
    <mno>testing</mno>
    </jkl>
    </abc>
    We can store the <def> tag in one table say def and <jkl> tag in another table say jkl.
    Is there a way to combine def and jkl and insert in one table so that there in one row with two columns test and testing??
    null

    Hi,
    Are u sure that it is a java enabled database? The most common
    case of failure with the xmlgen package is because the loadjava
    command did not succeed.
    Please make sure that oraclexmlsqlload.bat file loaded all the
    java procedures successfully. If not then u would have to java-
    enable your database by running the initjvm script. (please see
    the docs).
    Thx
    Murali
    Iveta Vojtko (guest) wrote:
    : Hi,
    : I have downloaded XML SQL Utility for Java against Oracle
    8.0.5
    : on WindowsNT. The xmlgen package was created successfully but
    : its body is invalid and my PL/SQL test has failed because of
    : following error: PLS-00103: Encountered the symbol "NAME"
    : when expecting one of the following: := . ( @ % ; not null
    range
    : renames default character. The symbol ":= was inserted abefore
    : "NAME" to continue.
    : Is it because I am not using Oracle8i? I just want to use the
    : server side of XML SQL. Please, reply asap. Thank you.
    Oracle Technology Network
    http://technet.oracle.com
    null

  • How to remove sql statement in spool output?

    Hi Gurus,
    If my spool query is like this
    set feedback off
    set verify off
    set trimspool on
    set heading off
    spool c:\test\test.csv
    select * FROM test;
    spool offI am getting my csv file as like this:
    SELECT * FROM test1
    SSO                 
    shsrgh              
    dehrerdh            
    wtw55hd             
    dhdfhdfh            
    hdhdh               
    SET SPOOL OFF;What do I need to change in my SQL query such that I will not include these lines:
    SELECT * FROM test1
    SSO                 
    SET SPOOL OFF;Thanks

    user10679113 wrote:
    What do I need to change in my SQL query such that I will not include these lines:
    SELECT * FROM test1
    SSO                 
    SET SPOOL OFF;
    You cannot change anything in your SQL query so as to exclude those lines.
    Those lines pertain to the client you are using viz. SQL*Plus and do not have anything to do with the SQL language per se.
    You could put all those SQL*Plus commands in a script file and run that script file from SQL*Plus, as shown below:
    test@ORA10G>
    test@ORA10G> -- show contents of the script: c:\test.sql
    test@ORA10G> host type c:\test.sql
    set feedback off
    set trimspool on
    set heading off
    set echo off
    spool c:\test.log
    select ename from emp;
    spool off
    set echo on
    set heading on
    set feedback on
    test@ORA10G>
    test@ORA10G> -- run the script
    test@ORA10G> @c:\test.sql
    SMITH
    ALLEN
    WARD
    JONES
    MARTIN
    BLAKE
    CLARK
    SCOTT
    KING
    TURNER
    ADAMS
    JAMES
    FORD
    MILLER
    test@ORA10G> set heading on
    test@ORA10G> set feedback on
    test@ORA10G>
    test@ORA10G> -- show contents of the spooled file: c:\test.log
    test@ORA10G> host type c:\test.log
    SMITH
    ALLEN
    WARD
    JONES
    MARTIN
    BLAKE
    CLARK
    SCOTT
    KING
    TURNER
    ADAMS
    JAMES
    FORD
    MILLER
    test@ORA10G>HTH,
    isotope

  • How to use parameters in oracle SQL script????

    Right now I am writing a SQL script to create a schema and build the objects of this schema....
    I use a .net winform program to run sqlplus to parse this sql script ...
    The problem is that the schema name and the tablespace's location and the sys password must be input by the user, so my SQL script should use these runtime input parameters instead of const parameters....
    So, how to use parameter in SQL script ...........
    Are there some example scripts in oracle home directory for me to refer to????

    Hi,
    UNISTD wrote:
    thanks .....
    what's the difference between variable , define, accept in sqlplus ???VARIABLE declares (but does not assign a value to) a bind variable. Unlike substitution variables, bind variables are passed to the back end to be compiled, and they can only be values in certain data types. You can not use a bind vaiable in place of an identifier, so to do something like
    CREATE USER  &1 ...a bind variable won't work.
    "DEFINE x = y" sets the substitution variable &x to have the value y. There is no user interaction (unless x or y happen to contain undefined substtiution variables).
    "DEFINE x" shiows the value of the substitution variable &x, or, if it is undefined, raises a SQL*Plus error. I use this feature below.
    ACCEPT sets a substitution variable with user interaction.
    And if the user miss some parameters in “sqlplus /nolog ssss.sql par1 par2 par5 par6”, how to use default value of the miss parameters??Don't you need a @ befiore the script name, e.g.
    sqlplus /nolog @ssss.sql par1 par2 par5 par6Sorry, I don't know of any good way to use default values.
    The foloowing works, but, as you can see, it's ugly.
    "DEFINE 1" display a message like
    DEFINE 1            = "par1" (CHAR)if &1 is defined; otherwise,it will display a SQL*Plus error message like
    SP2-035: symbol 1 is UNDEFINEDNotice that the former contains an '=' sign, but the latter does not.
    The best way I know to use default values is to run the DEFINE command, save the output to a filee, read the file, and see if it's an error message or not.
    So you can use a script like this:
    --     This is  DEFINE_DEFAULT.SQL
    SPOOL     got_define_txt.sql
    DEFINE     &dd_old
    SPOOL     OFF
    COLUMN     dd_new_col     NEW_VALUE     &dd_new
    WITH     got_define_txt     AS
         SELECT  q'[
              @got_define_txt
    ]'               AS define_txt
         FROM    dual
    SELECT     CASE
             WHEN  define_txt LIKE '%=%'
             THEN  REGEXP_REPLACE ( define_txt
                               , '.+"
    ([^"]*)
                         , '\1'
             ELSE  '&dd_default'
         END        AS dd_new_col
    FROM     got_define_txt
    {code}
    and start your real script, ssss.sql, something like this:
    {code}
    DEFINE          dd_new     = sv1
    DEFINE          dd_old     = 1
    DEFINE          dd_default     = FOO
    @DEFINE_DEFAULT
    DEFINE          dd_new     = sv2
    DEFINE          dd_old     = 2
    DEFINE          dd_default     = "Testing spaces in value"
    @DEFINE_DEFAULT
    {code}
    when this finishes running, the substitution variable &sv1 will either have the value you passed in &1 or, if you didn't pass anything, the default value you specified, that is FOO.
    Likewise, &sw2 will have the value you passed, or, if you didn't pass anything, the 23-character string 'Testing spaces in value'.
    Here's how it works:
    Define_default.sql puts the output of the "DEFINE x" command into a column, define_txt, in a query.  That query displays either the existing value of the substitution variable indicated by &dd_old or, if it is undefined, the default value you want to use, which is stored in the substitution variable &dd_default.  The substitution variable named in &dd_new is always set to something, but that something may be its existing value.
    Notice that the paramerters to define_default.sql must be passed as global varibales.
    Why didn't I just use arguments, so that we could simply say:
    {code}
    @DEFINE_DEFAULT  sv1  1  FOO
    {code}
    ?  Because that would set the substitution variables &1, &2 and &3, which are miost likely the very ones in which you're interested.
    I repeat: there must be a better way, but I'm sorry, I don't know what it is.
    I usually don't do the method above.  Instead, I always pass the required number of parameters, but I pass dummy or plce-holder values.
    For example, if I wanted to call ssss.sql, but use defulat vlaues for &1 and &3, then I would say something like:
    {code}
    @ssss  ?  par2  ?
    {code}
    and, inside ssss.sql, test to see if the values are the place holder '?', and, if so, replace them with some real default value.  The use has  to remember what the special place holder-value is, but does not need to know anything more, and only ssss.sql itself needs to change if the default values change.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Maybe you are looking for