How to compile a procedure from Sql*Plus?

Dear friends,
I couldnt find the way how to compile my invalid procedure through sql*Plus.
I know this is very awkward,but I m in need of that command only.
Thanks
Ritesh Sharma

Pls check it --
SQL>
SQL>
SQL> @C:\RND\Oracle\Function\a.sql;
11  /
Function created.
SQL>
SQL>
SQL> start C:\RND\Oracle\Function\a.sql;
11  /
Function created.
SQL> Regards.
Satyaki De.

Similar Messages

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

  • How to view  a stored procedure from sql plus

    Can anyone please tell what is the command for viewing the content of the stored procedure from sql plus ?
    Thanks

    Hi,
    I use this simple script to retrieve.......
    EDTRAD@T_E_S_9-->l
    1 select text from all_source where name = 'GET_MAN' -- proc name here
    2* order by line asc
    EDTRAD@T_E_S_9-->/
    TEXT
    FUNCTION get_man (in_man SSBOSS.CLNTWORK.manager%type)
    RETURN varchar2 IS
    CURSOR get_man(in_man SSBOSS.CLNTWORK.manager%type) IS
    SELECT name
    FROM ssboss.clntwork
    WHERE agency = 'TM'
    AND manager = in_man
    AND manager is not null
    AND manager != '**OB**';
    v_man SSBOSS.CLNTWORK.name%type := null;
    BEGIN
    OPEN get_man(in_man);
    FETCH get_man INTO v_man;
    IF get_man%notfound THEN
    v_man := 'Manager Not Found !';
    RETURN (v_man);
    CLOSE get_man;
    END IF;
    RETURN (v_man);
    CLOSE get_man;
    END;
    21 rows selected.
    EDTRAD@T_E_S_9-->

  • How to Call a Procedure from SQL ?

    Hi All,
    I've a procedure defined like the below taking IN/OUT parameters as table type.
    PROCEDURE "SAP_HANA_DEMO"."usersCreateMethod" (IN row "SAP_HANA_DEMO"."User.Details",
    OUT error "SAP_HANA_DEMO"."EPM.Procedures.tt_errors")
    Now, how do i call it from SQL ?
    I'm trying to call it like
    CALL "SAP_HANA_DEMO"."usersCreateMethod"('my_global_table','?');
    It says
    Could not execute 'CALL "SAP_HANA_DEMO"."sap.hana.democontent.epm.Procedures::usersCreateMethod"('my_global_table','?')'
    SAP DBTech JDBC: [1288]: expression cannot be used as an assignment target: '?': line 1 col 97 (at pos 96)
    Thanks & Regards
    Sakthivel

    Hi ,
    You should call like this
    Define a variable of your table type.
    Define ErrorMessage SAP_HANA_DEMO"."EPM.Procedures.tt_errors"
    CALL "SAP_HANA_DEMO"."usersCreateMethod"('my_global_table',ErrorMessage);
    Regards,
    Krishna Tangudu

  • Need urgent help - how to call a procedure from sql returning a rowset

    Hello,
    I need to send a SQL Query from a VB application to let it execute on the oracle DB. This query needs to call a procedure/function, which returns a resultsets, so that i can to a (Where x in ( <call procedure> )). Would result in Where x in (50,100,3094).
    Is this possible in oracle, and how?
    Thanks.
    Daniel Meyer

    Hi Daniel,
    I had a similiar problem yesterday.
    Thanks to the nice people in this forum I was able to figured that out.
    So here is a PL/SQL Oracle 9i code for your reference.
    You can create and test it using the SQL Plus console.
    I used this stored procedure in my VB .NET and worked fine!
    I am enclosing the VB code in this reply as well.
    One last note: in order to test it in the VS .NET, don't forget to download the Oracle ODP driver for .NET
    Good luck!
    Amintas
    create or replace package pkg_emp
    AS
    type rc_emp is ref cursor;
    end;
    create or replace
    procedure SP_GetEmpData(v_empno IN emp.empno%Type,
    v_ename IN emp.ename%Type,
    emp_cur OUT pkg_emp.rc_emp)
    is
    begin
    if v_empno is not null and v_ename is null then
    OPEN emp_cur for
    select empno,ename,sal
    from emp
    where empno=v_empno;
    elsif v_ename is not null and v_empno is null then
    OPEN emp_cur for
    select empno,ename,sal
    from emp
    where ename like v_ename ||'%';
    end if;
    end;
    /* Testing the stored procedure */
    /*#1 */
    var myresultset refcursor;
    execute SP_GetEmpData(7900,null,:myresultset);
    print myresultset;
    /*#2 */
    var myresultset refcursor;
    execute SP_GetEmpData(null,'A',:myresultset);
    print myresultset;
    -x-x-x-x-x-x-x-x-x VB .NET CODE x-x-x-x-x-x-x-xx-x-
    Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProcurar.Click
    Dim dr As Oracle.DataAccess.Client.OracleDataReader
    Try
    If txtEmpNo.Text <> "" Then
    dr = GetData(CInt(Val(txtEmpNo.Text)), "")
    Else
    dr = GetData(0, UCase(txtEname.Text))
    End If
    txtEmpNo.Text = ""
    txtEname.Text = ""
    Catch ex As Exception
    Response.Write(ex)
    End Try
    drgTest.DataSource = dr
    drgTest.DataBind()
    End Sub
    Private Function GetData(ByVal v_empno As Integer, ByVal v_ename As String) As Oracle.DataAccess.Client.OracleDataReader
    Dim cn As New Oracle.DataAccess.Client.OracleConnection(ConfigurationSettings.AppSettings("ConnectionString"))
    Dim cmd As New Oracle.DataAccess.Client.OracleCommand
    Dim dr As Oracle.DataAccess.Client.OracleDataReader
    cmd.Connection = cn
    cmd.CommandType = CommandType.StoredProcedure
    cmd.CommandText = "SP_GetEmpData"
    cmd.Parameters.Add("v_empno", Oracle.DataAccess.Client.OracleDbType.Int32).Value = IIf(v_empno = 0, System.DBNull.Value, v_empno)
    cmd.Parameters.Add("v_ename", Oracle.DataAccess.Client.OracleDbType.Varchar2, 40).Value = IIf(v_ename = "", System.DBNull.Value, v_ename)
    cmd.Parameters.Add("rc_emp", Oracle.DataAccess.Client.OracleDbType.RefCursor).Direction = ParameterDirection.Output
    Try
    cn.Open()
    dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
    Catch ex As Exception
    Throw ex
    Exit Function
    End Try
    Return dr
    End Function

  • How to return a value from sql plus activity

    Hi,
    I want to return a value from sqlplus activity to a processflow variable.
    SQL PLUS activity has a property :"RESULT_CODE", whenever i run the process flow this value is always reurned as 0.
    in sqlplus activity i have written some pl/sql block....
    for example
    begin
    end;
    exit
    i want to do something like
    begin
    if v=100 then
    return 1
    else
    return 0;
    end if;
    end;
    exit
    can some please tell me how can i return value from this pl/sql block to proessflow.
    Regards,
    RD_RBS

    table ==> function
    input param from table to function. ==> input mapping paramter to store the output from the mapping.
    Will this now work.

  • How to detect client OS from SQL*Plus script

    Sometimes in a SQL*Plus script I need to execute OS commands e.g.
    host rm tempfile.bufHowever of course Windows has no "rm" command by default, so I have to edit the script to use
    host del tempfile.bufNow if I could define &DELETE (for example, "cat"/"type" is another) as a substitution variable, I could just use
    host &DELETE tempfile.bufMaybe I need more coffee but all I could come up with was something like this:
    def rm=rm
    def cat=cat
    spool sqlplus_windows_defs.cmd
    prompt echo def rm=del
    prompt echo def cat=type
    spool off
    host .\sqlplus_windows_defs > sqlplus_windows_defs.sql
    @sqlplus_windows_defs.sql
    host &rm sqlplus_windows_defs.cmd
    host &rm sqlplus_windows_defs.sqlthe idea being that you first define the variables for nix ("rm" and "cat"), then attempt to create and execute a Windows command file containing DOS versions ("dele" and "type"), which does not run under nix. Unfortunately the OS failure message (".sqlplus_windows_defs: not found" in Unix) appears on the screen despite SET TERM OFF, so I'm back where I started.
    I know there are various ways to get the server OS, and you can get the SQL*Plus version with &_SQLPLUS_RELEASE and so on, but I can't see a way to determine the client OS. Any suggestions?

    Thanks guys. This seems to work in Windows XP - will try on Unix when I get a chance:
    col DELETE_COMMAND new_value DELETE_COMMAND
    col LIST_COMMAND new_value LIST_COMMAND
    def list_command = TYPE
    def delete_command = DEL
    SELECT DECODE(os,'MSWIN','TYPE','cat') AS list_command
         , DECODE(os,'MSWIN','DEL','rm')   AS delete_command
    FROM   ( SELECT CASE WHEN UPPER(program) LIKE '%.EXE' THEN 'MSWIN' END AS os
             FROM   v$session
             WHERE  audsid = SYS_CONTEXT('userenv','sessionid') );
    host &LIST_COMMAND xplan_errors.lst
    host &DELETE_COMMAND xplan_errors.lstIf the user doesn't have access to v$session it will just default to the Windows commands.
    http://www.williamrobertson.net/code/xplan.sql

  • How to Strip Extraneous Output from SQL*Plus Session

    We are running Oracle Database 11g on Solaris 10, and I am trying to use SQL*Plus to create a temporary .sql file that I can execute in a later step of a Korn shell script. Here is the code:
         $ORACLE_HOME/bin/sqlplus / as sysdba <<EOF
    --whenever oserror exit failure;
    --whenever sqlerror exit sql.sqlcode;
    set serveroutput on
    set termout off
    set trimspool on
    set verify off
    set heading off
    set feedback off
    set echo off
    spool /usr/oracle/temp/apply_site_security_for_oracle_database_11g.ksh.tmp
    declare
         Value_DSC varchar2(2000);
         CommandLine_DSC varchar2(4000);
    begin
         select v\$parameter.value into Value_DSC from v\$parameter where lower(name)='diagnostic_dest';
         CommandLine_DSC := 'host chmod 751 ' || Value_DSC;
         dbms_output.put_line('--Ready to execute: ' || CommandLine_DSC);
         dbms_output.put_line(CommandLine_DSC);
         CommandLine_DSC := 'host ls -ld ' || Value_DSC;
         dbms_output.put_line('--Ready to execute: ' || CommandLine_DSC);
         dbms_output.put_line(CommandLine_DSC);
    end;
    spool off;
    exit;
    EOF
    I've tried to turn off everything I don't need, but I am missing something. When I run the script, I get the following in the temporary file:
    SQL>
    SQL> declare
    2 Value_DSC varchar2(2000);
    3 CommandLine_DSC varchar2(4000);
    4
    5 begin
    6 select v$parameter.value into Value_DSC from v$parameter where lower(name)='diagnostic_dest';
    7
    8 CommandLine_DSC := 'host chmod 751 ' || Value_DSC;
    9 dbms_output.put_line('--Ready to execute: ' || CommandLine_DSC);
    10 dbms_output.put_line(CommandLine_DSC);
    11
    12 CommandLine_DSC := 'host ls -ld ' || Value_DSC;
    13 dbms_output.put_line('--Ready to execute: ' || CommandLine_DSC);
    14 dbms_output.put_line(CommandLine_DSC);
    15 end;
    16 /
    --Ready to execute: host chmod 751 /s01/app/oracle
    host chmod 751 /s01/app/oracle
    --Ready to execute: host ls -ld /s01/app/oracle
    host ls -ld /s01/app/oracle
    SQL>
    SQL> spool off;
    I am hoping to whittle this down to just the following lines so I can execute them as a script.
    --Ready to execute: host chmod 751 /s01/app/oracle
    host chmod 751 /s01/app/oracle
    --Ready to execute: host ls -ld /s01/app/oracle
    host ls -ld /s01/app/oracle
    Any ideas?
    Edited by: shew01 on Jan 19, 2010 10:51 AM

    I just found it. Just add "-S" to the sqlplus command. Argh... I hunted for that a while back. Why didn't I remember it??????????
    This works:
         $ORACLE_HOME/bin/sqlplus -S / as sysdba <<EOF
    whenever oserror exit failure;
    whenever sqlerror exit sql.sqlcode;
    set serveroutput on
    set linesize 2000
    set pagesize 0
    set termout off
    set trimspool on
    set feedback off
    spool /usr/oracle/temp/apply_site_security_for_oracle_database_11g.ksh.tmp
    declare
         Value_DSC varchar2(2000);
         CommandLine_DSC varchar2(4000);
    begin
         select v\$parameter.value into Value_DSC from v\$parameter where lower(name)='diagnostic_dest';
         CommandLine_DSC := 'host chmod 751 ' || Value_DSC;
         dbms_output.put_line('--Ready to execute: ' || CommandLine_DSC);
         dbms_output.put_line(CommandLine_DSC);
         CommandLine_DSC := 'host ls -ld ' || Value_DSC;
         dbms_output.put_line('--Ready to execute: ' || CommandLine_DSC);
         dbms_output.put_line(CommandLine_DSC);
    end;
    spool off;
    exit;
    EOF
    Edited by: shew01 on Jan 19, 2010 11:02 AM

  • How to run OWB mappings from SQL*Plus

    Hi:
    I used to run OWB mappings using the sample code RUN_MY_OWB_STUFF in a customized PL/SQL procedure. This works for OWB 10g release 1 but not for OWB Paris (10g Release 2) because the execution always returns FAILURE.
    Is there something new in OWB Paris that RUN_MY_OWB_STUFF doesn't work anymore?
    Thanks,
    Hazbleydi C. Verástegui

    Hi Maruthi:
    I already check the input parameters of the mapping. I'm setting them as a custom parameters. This is the output of the execution:
    16:01:11 SQL> EXEC PR_RUN_OWBMAPPING_TABLA2('MPG_EMPLEADOS_NOMINA_PERIODO',2007,01);
    Stage 1: Decoding Parameters
    | location_name=LOC_DM_STAGING
    | task_type=PLSQL
    | task_name=MPG_EMPLEADOS_NOMINA_PERIODO
    Stage 2: Opening Task
    | l_audit_execution_id=39635
    Stage 3: Overriding Parameters
    | P_ANO%CUSTOM='2007'
    | P_MES%CUSTOM='1'
    Stage 4: Executing Task
    | l_audit_result=3 (FAILURE)
    Stage 5: Closing Task
    Stage 6: Processing Result
    | exit=3
    By the way, RUN_MY_OWB_STUFF is the same as RUN_OWB_CODE.sql except for the two first parameters (p_result and p_audit_id):
    create or replace procedure run_owb_code
    ( p_result out number
    , p_audit_id out number
    , p_repos_owner in varchar2 default null
    , p_location_name in varchar2 default null
    , p_task_type in varchar2 default null
    , p_task_name in varchar2 default null
    , p_system_params in varchar2 default '","'
    , p_custom_params in varchar2 default '","'
    , p_oem_friendly in number default 0
    is
    CREATE OR REPLACE function run_my_owb_stuff
    ( p_repos_owner in varchar2 default null
    , p_location_name in varchar2 default null
    , p_task_type in varchar2 default null
    , p_task_name in varchar2 default null
    , p_system_params in varchar2 default '","'
    , p_custom_params in varchar2 default '","'
    , p_oem_friendly in number default 0
    ) return number
    is
    How do you invoke your wrapper PL/SQL with these two first parameters?
    Thanks in advance,
    Hazbleydi C. Verástegui

  • Calling a function from sql*plus

    I can call my procedure from sql *plus
    by doing
    sql>call Proc_name(x,y);
    How do you call a function?
    null

    John,
    I think moifying the statement
    CREATE OR REPLACE PROCEDURE "OGUSER"."OGX1" (user_county in integer, user_permit in integer )
    TO
    CREATE OR REPLACE FUNCTION "OGUSER"."OGX1" (user_county in integer, user_permit in integer ) return NUMBER is
    AND before end you will have to add a return statement
    (Probably
    return 0;
    exception
    when others then
    return 1;
    end;
    This will change your procedure to a function but I am not sure you'll be able to see your dbms_output's, if you call the function using select ...
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by john saucer ([email protected]):
    I want to turn my procedure into a function.
    So I can call it with a select statement.
    I'm kind of having problems with the return statement at the top and bottom.
    I don't quite understand how to declare the type in the return. My procedure calculates 2 pl/sql tables....
    My procedure looks like.
    CREATE OR REPLACE PROCEDURE "OGUSER"."OGX1" (user_county in integer, user_permit in integer )
    as
    i integer :=0;
    j integer :=0;
    type dept_table_type is table of ogxtest%rowtype
    index by binary_integer;
    type dept2_table_type is table of ogxtest%rowtype
    index by binary_integer;
    my_dept_table dept_table_type;
    my_dept2_table dept2_table_type;
    v_cotemp number := user_county;
    v_permittemp number := user_permit;
    v_origcotemp number := user_county;
    v_origpermittemp number := user_permit;
    v_count number(2) :=1;
    v_count2 number(2) := 1;
    v_oldcount number(2) :=1;
    v_oldcount2 number(2) := 1;
    begin
    select count(*) into v_count from ogxtest where oco=v_cotemp and opermit=v_permittemp;
    select count(*) into v_oldcount from ogxtest where nco=v_cotemp and npermit=v_permittemp;
    while v_count >= 1 LOOP
    i := i+1;
    v_count2 := v_count2 +1;
    select *
    into my_dept_table(i)
    from ogxtest where oco=v_cotemp and opermit=v_permittemp;
    v_cotemp := my_dept_table(i).nco;
    v_permittemp := my_dept_table(i).npermit;
    select count(*) into v_count from ogxtest where oco=v_cotemp and opermit=v_permittemp;
    end loop;
    while v_oldcount >= 1 LOOP
    j := j+1;
    v_oldcount2 := v_oldcount2 +1;
    select *
    into my_dept2_table(j)
    from ogxtest where nco=v_origcotemp and npermit=v_origpermittemp;
    v_origcotemp := my_dept2_table(j).oco;
    v_origpermittemp := my_dept2_table(j).opermit;
    select count(*) into v_oldcount from ogxtest where nco=v_origcotemp and npermit=v_origpermittemp;
    end loop;
    for i in 1..v_count2-1
    loop
    dbms_output.put_line(' reassigned to - orig county ' | |my_dept_table(i).oco | | ' orig permit ' | |my_dept_table(i).opermit| | ' new county ' | |
    my_dept_table(i).nco | | ' new permit ' | |my_dept_table(i).npermit );
    end loop;
    for j in 1..v_oldcount2-1
    loop
    dbms_output.put_line(' reassigned from - orig county ' | |my_dept2_table(j).oco | | ' orig permit ' | |my_dept2_table(j).opermit| | ' new county ' | |
    my_dept2_table(j).nco | | ' new permit ' | |my_dept2_table(j).npermit );
    end loop;
    end;
    <HR></BLOCKQUOTE>
    null

  • How to execute procedure returning data rows from sql plus

    Hi,
    I want to execute a stored procedure that returns data rows from sql plus. please let me know the syntax for the same.
    Thanks,
    YG

    user13065317 wrote:
    Even if i get the result set into the cursor, do i have to do normal fetch into all the coumn variables within a loop
    But suppose no of columns in my result set varies depending on a parameter to the stored procedure.
    Is there any straightforward way to retrieve all the data irrespective of no of columns in the result set.There is no such thing as a "+result set+". Oracle does not create a temporary data set in memory that contains the results of your query. What would happen if this result set is a million rows and is too large to fit into memory? Or there are a 100 clients each with a 100,000 row result set?
    This is not scalable. You will be severely limited in the number and sizes of these "+result sets+" that can be created in server memory.
    A cursor is in fact a "program" that is created by compiling the SQL source code that you provide. This source code is parsed and compiled into what Oracle calls an execution plan. This is nothing but a series of instructions that the cursor will execute in order to return the rows required.
    Thus the result set is actually the output from a cursor (a program). Likewise, bind variables are the input parameters to this program.
    All SQLs are parsed and compiled as cursors and stored in the SQL Shared Pool. Oracle gives you handle in return to use to address this cursor - bind values to it, execute it, describe the output structure returned by the cursor, and fetch the output from the cursor.
    On the client side, this handle is used in different ways. In PL/SQL alone, this cursor handle can be used as an implicit cursor (you do not even see or use the cursor handle in your PL/SQL code). Or you can use a PL/SQL cursor variable. Or a DBMS_SQL cursor variable. Or a reference cursor variable.
    Why so many different client structures for the very same SQL cursor handle returned by Oracle? Because to allow you, the programmer, all kinds of different features and flexibility.
    The ref cursor feature is the ability to pass this cursor handle around, not only between PL/SQL code, but also from PL/SQL to the actual client process (Java. VB, SQL*Plus, TOAD, etc).
    The primary thing to remember - irrespective of what the client calls this (e.g. ref cursor, SQL statement handle, etc), this all refers to the same SQL cursor in the Shared Pool. And that this SQL cursor is a program that outputs data, and not a result set in itself.

  • How to copy procedure to sql plus window.

    I am trying to copy my procedure from note pad to sql plus window and some of the texts are being cut off. How can I copy the entire procedure to sql plus window.
    thanks

    Thank you guys this is what is happning.
    1  CREATE OR REPLACE PROCEDURE  ITEMCUSTOMPAGING(
    2        p_desc in itemlist.idescr%type,
    3        p_letting in bidlet.datelet%type,
    4        p_letting1 in bidlet.datelet%type,  
    5       p_sort in  NUMBER ,
    6       p_order in VARCHAR ,
    7        i_results    out sys_refcursor
    8     )
    9     AS
    10     BEGIN
    11        OPEN  i_results  FOR
    12         SELECT g.csecnum , e.iplineno , substr(e.eiitem ,1,4)||'.'||substr(e.eiitem ,5,9) ItemNum,
    13         INITCAP(i.idescr ||'  '|| e.isupdes)  Descrip,INITCAP(i.idescrl ||'  '|| e.isupdes)  Descrip
    14         DECODE (TRIM (p.prroute), NULL, 'N/A',p.prroute) Route,b.datelet  ,trim(to_char(b.datelet ,'
    15        FROM itemlist i, estitem e, estcatg g, propproj x, proposal p, bidlet b, letprop l
    16        WHERE    p.contid = x.contid AND x.pcn = g.pcn AND e.pcn = g.pcn AND e.cn = g.cn AND i.item =
    17        AND i.ispecyr = p.cspecyr AND e.iplineno <> ' ' AND e.eiitem <> '2550601/01000'
    18        AND e.eiitem <> '2565601/00031' AND e.eiitem <> '2565601/00032' AND e.eiitem <> '2565601/0003
    19        AND e.eiitem <> '2402601/01000'
    20        AND (i.idescr  like  TRIM(UPPER(p_desc))||'%'  or  i.idescrl  like  TRIM( UPPER(p_desc))||'%'
    21        AND b.datelet  between  p_letting  and p_letting1
    22        AND p.contid = l.lcontid
    23        AND l.letting = b.letting
    24        AND SUBSTR (l.lcontid, 4, 4) <= '5'
    25        GROUP BY g.csecnum,i.idescr,b.datelet,i.iunits,p.clocat1,p.clocat2,p.contid,p.cdescr, p.cproj
    26        ORDER BY p_sort   p_order;
    27* End;
    QL> /
    arning: Procedure created with compilation errors.
    QL> SHOW ERR
    rrors for PROCEDURE ITEMCUSTOMPAGING:
    INE/COL ERROR
    2/8     PL/SQL: SQL Statement ignored
    6/25    PL/SQL: ORA-00933: SQL command not properly ended
    QL>

  • How to pass table type variable into function from SQL*PLUS ?

    How to pass a table type variable from sql*plus prompt into a function ?
    Thanx in advance.

    Krishna,
    Do you mean like this?SQL> DECLARE
      2      TYPE t_tbl IS TABLE OF VARCHAR2(20);
      3      l_sample_tbl           t_tbl;
      4
      5      FUNCTION print_contents ( p_tbl IN t_tbl )
      6      RETURN VARCHAR2
      7      IS
      8          l_string            VARCHAR2(1000);
      9      BEGIN
    10          FOR i IN 1..p_tbl.COUNT LOOP
    11              IF (i = 1) THEN
    12                  l_string := p_tbl(i);
    13              ELSE
    14                  l_string := l_string || ', ' || p_tbl(i);
    15              END IF;
    16          END LOOP;
    17          RETURN (l_string);
    18      END print_contents;
    19
    20  BEGIN
    21      l_sample_tbl := t_tbl();
    22      l_sample_tbl.EXTEND;
    23      l_sample_tbl(1) := 'one';
    24      l_sample_tbl.EXTEND;
    25      l_sample_tbl(2) := 'two';
    26      l_sample_tbl.EXTEND;
    27      l_sample_tbl(3) := 'three';
    28      l_sample_tbl.EXTEND;
    29      l_sample_tbl(4) := 'four';
    30      l_sample_tbl.EXTEND;
    31      l_sample_tbl(5) := 'five';
    32      DBMS_OUTPUT.PUT_LINE(print_contents(l_sample_tbl));
    33  END;
    34  /
    one, two, three, four, five
    PL/SQL procedure successfully completed.
    SQL> HTH,
    T.

  • How to pass Unix environment variable to a SQL procedure or SQL * Plus

    Can any body suggest me how to ,
    How to pass Unix environment variable to a SQL procedure or SQL * Plus file..
    I am trying to invoke a SQL Procedure from Unix
    by passing the value of a Unix environment variable.
    Is it possible..?
    Thanks in advance.
    Regards,
    Srinivas Jaltaru

    Within your shell script you can use what is known as a "here document" which is basically a way of wrapping a call to Oracle. The following call to Oracle loops and writes rows to files with numerically increasing file names. Two unix shell variables are used, one in a select statement and one in a spool command :
    <pre>
    #!/bin/bash
    export ORACLE_SID=DEV05
    FILENO=1007351
    while [ ${FILENO} -le 1008400 ]
    do
    FILENAME=farm_${FILENO}.txt
    DUMMY=`sqlplus -s user20/user20 <<SQLSTOP
    set lines 73
    set pages 0
    set head off
    set termout off
    set echo off
    set feedback off
    select rpad(searchx, 8)
    from blastx@PRODUCTION
    where searchx = ${FILENO} ### here's a shell variable
    spool /export/home/user20/sql/psiblast/BACKUP2_D/${FILENAME} ### here's a shell variable
    spool off
    SQLSTOP`
    FILENO=`expr ${FILENO} + 1`
    done
    exit 0
    </pre>

  • How to exit from SQL PlUS

    HI,I came to know that direct exit from SQL Plus without Oracle shutdown causes future issues of ORA-0600 kind of errors. Is it true? If yes could u pls suggest me how to shutdown from user "SYSTEM/manager". Bcoz with this am warned that I dont have previleges.

    Hello,
    HI,I came to know that direct exit from SQL Plus without Oracle shutdown causes future issues of ORA-0600 kind of errors. Is it true?The ORA-00600 is an internal error it can be caused for instance by a Bug, a corruption, ... , and if someday you experience this kind of error, you should open a Service Request to My Oracle Support.
    However, I've never heard that exiting sqlplus could cause this kind of error. Where did you get such information ?
    how to shutdown from user "SYSTEM/manager". To shutdown the database you should be connected with the User SYS (as SYSDBA). You may use the following statement:
    sqlplus /nolog
    connect / as sysdba
    shutdown immediate;
    exitHope this help.
    Best regards,
    Jean-Valentin

Maybe you are looking for

  • Why do I get the error message "unable to load page (HTTP 502) when I try to open Mobile Web?

    I have an LG Octane 3 basic phone.   Does everything I need, phone and text, and I never was interested in web or e-mail capabilities until I recently upgraded our plan to the "More Everything" and was able to use data and check e-mail and access the

  • Issue in running autoconfig in appsTier while cloning

    Hi my dear Friends I am working on a clone. I completed post clone in dbTier. Now my DB is up and running. Then I ran adcfgclone.pl in appsTier. It completed with some errors in autoconfig. The content of log file: [AutoConfig Error Report] The follo

  • I cannot access my iphoto library on my external Hard drive

    Hello, I backed up my iphoto library to an external hard drive. Now when I try to access it, all I get are dotted outlines where the pictures should be and then when I click on a the dotted outline it gives me an exclamation mark in a triangle. Help!

  • 2 renderers in layout set reading from different areas of km repository

    Good Day I have a layout set which contains 2 collection renderers. Each renderer must display content from different areas of the km repository in a way that is controlled by the KM Navigation iView parameters "Path to root folder" & "Path to initia

  • Creating this in flash

    I took a job from my boss, and I really don't know how I will go about doing this. I am very new to flash. All I know is that I need something like this: [URL=http://www.ryanair.com/site/EN/dests.php?flash=chk]Destinations map [/URL] I need something