Compilation failure, line 5 (11:02:10) PLS-00103: encountered the symbol "POR".

I want to send an e-mail message using pl/sql and write the following code, but while compling, error must be occure
"Failure of compilation, line 5 (11:02:10).
PLS-00103: encountered the symbol "PortNumber" when expecting one of the following values:; "with authid as order of external assistance cluster parallel_enable deterministic result_cache pipeline."



create or replace procedure SEND_TEST_EMAIL
(mailhost IN VARCHAR2 default 'smtp.exchangesetup.com',
sender VARCHAR2 default '[email protected] '.
recipient in VARCHAR2 default '[email protected]')
port_number in default number 25
)
is
BEGIN
8 mail_conn: = UTL_SMTP. OPEN_CONNECTION (mailhost, 25);
9 UTL_SMTP. HELO (mail_conn, mailhost);
10 UTL_SMTP. MAIL (mail_conn, sender);
11 UTL_SMTP. RCPT (recipient, mail_conn);
12
13 UTL_SMTP. OPEN_DATA (mail_conn);
14 UTL_SMTP. WRITE_DATA (mail_conn, "it is a test message.");
15 UTL_SMTP. WRITE_DATA (mail_conn, 'It is the 2 line.');
16 UTL_SMTP. CLOSE_DATA (mail_conn);
21 UTL_SMTP. Quit (mail_conn);
22 EXCEPTION
23 SO THAT OTHERS THEN
25 NULL;
26 END;

NOT TESTED
Describe below in the part of the statement

mail_conn UTL_SMTP.CONNECTION;     

as

CREATE OR REPLACE PROCEDURE SEND_TEST_EMAIL
(mailhost IN VARCHAR2 DEFAULT 'smtp.exchangesetup.com',
sender VARCHAR2 DEFAULT '[email protected]',
recipient IN VARCHAR2 DEFAULT '[email protected]',                               -----code change , removed ')' add ','
port_number IN NUMBER DEFAULT 25
)
IS
mail_conn UTL_SMTP.CONNECTION;                                                                                   -----code change added mail_conn UTL_SMTP.CONNECTION;
BEGIN
mail_conn := UTL_SMTP.OPEN_CONNECTION(mailhost, 25);
UTL_SMTP.HELO(mail_conn, mailhost);
UTL_SMTP.MAIL(mail_conn, sender);
 UTL_SMTP.RCPT(mail_conn, recipient);
 UTL_SMTP.OPEN_DATA(mail_conn);
UTL_SMTP.WRITE_DATA(mail_conn, 'This is a test message.' );
 UTL_SMTP.WRITE_DATA(mail_conn, 'This is line 2.');
 UTL_SMTP.CLOSE_DATA(mail_conn);
 UTL_SMTP.QUIT(mail_conn);
EXCEPTION
 WHEN OTHERS THEN
 NULL;
 END;

Tags: Database

Similar Questions

  • PLS-00103: encountered the symbol "SYS_REFCURSOR" during the expected in the following way:

    Hey Geeks,

    I am trying to execute the procedure from the SQL Developer, but these errors are coming. What can I do wrong here...

    Procedure works fine when I run the compilation and debugging mode. But I need to put later in the c# code.

    SET serveroutput on;

    DECLARE

    OutParam1 to SYS_REFCURSOR;

    OutParam2 ON Varchar;

    BEGIN

    / * Call procedure package * /.

    SPAT_QUERY. SP_VALIDATERULES (9, 'BIS2015001', OutParam1, OutParam2);

    / * Display parameters * /.

    dbms_output.put_line ('OutParam1: ' |) OutParam2);

    END;

    -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    Error report-

    ORA-06550: line 3, column 20:

    PLS-00103: encountered the symbol "SYS_REFCURSOR" during the expected in the following way:

    := . (@ %; not null default range character)

    06550 00000 - "line %s, column % s:\n%s".

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    -Procedure below:

    create or replace PACKAGE SPAT_QUERY of BODY

    AS

    / * Declare a global variable to hold the result of the Validation. */

    valResult varchar (10);

    PROCEDURE SP_VALIDATERULES)

    IN_RQST_NUM NUMBER,

    IN_CASEID IN VARCHAR,

    OUT_REFCURSOR ON SYS_REFCURSOR,

    OUT_VAL_RSLT ON VARCHAR

    )

    AS

    p_rc sys_refcursor;

    I have NUMBER: = 0;

    / * Logical query - a loop in the Table of RULES based on request NUM * /.

    BEGIN

    FOR rec IN (SELECT * FROM T_RULES where RQST_NUM = IN_RQST_NUM)

    LOOP

    i: = i + 1;

    SP_GETSECTS (IN_CASEID, rec. LYR_TX, rec. TRGT_TX, rec. EXCPTD_RSLT_CD, p_rc);

    OUT_VAL_RSLT: = valResult;

    END LOOP;

    END SP_VALIDATERULES;

    Thank you

    Ken

    in anonymous block, variables cannot be defined in the form. IN and OUR are not variable parameters type

    Change your code to

    DECLARE

    OutParam1 SYS_REFCURSOR;

    OutParam2 Varchar;

  • PLS-00103: encountered the symbol 'NUMBER' when awaits a the follow

    Hi, I have this error:-

    OS: xp
    Oracle 8i

    SQL > Create or replace procedure Balance_chk is
    mclient_no 2 number (5);
    3 mbal_due number (10.2);
    4 less_than_min_bal
    number (3) add_amt 5.
    min_bal 6 number (7.2);
    7. start
    8 add_amt: = 500;
    9 min_bal: = 2000;
    10 mClient_no: = & mClient_no;
    11. Select bal_due in the Client_mast mbal_due where client_no = mClient_no;
    12 if mbal_due > = Min_bal then
    13 update client_mast set bal_due = (mbal_due + add_amt) where client_no is mclient_no;.
    14 end if;
    15 exception
    16 when less_than_min_bal then
    17 dbms_output.put_line (' balance ' | bal_due);
    18 end;
    19.
    Enter the value for mclient_no: 10001
    10 old: mClient_no: = & mClient_no;
    new 10: mClient_no: = 10001;

    CAUTION: Procedure created with compilation errors.

    SQL > show error
    Errors in PROCEDURE BALANCE_CHK:

    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    5/9 PLS-00103: encountered the symbol 'NUMBER' when waiting for an a
    What follows:
    := . (@ %; not null default range character)
    The symbol ': = ' was replaced by 'NUMBER' to continue.

    you are missing; at the end of the line 4

  • Error [PLS-00103: encountered the symbol "CREATE"] using PACKAGE

    Hi guys!
    When I compile this package, I get this error:
    PLS-00103: encountered the symbol "CREATE".

    How can I solve this problem?
    The compiled code is below:


    CREATE OR REPLACE
    PACKAGE CAMPO_PACK AS

    TYPE T_CURSOR IS REF CURSOR;

    PROCEDURE DeleteCode (OSDP NUMBER);

    END CAMPO_PACK;
    -body-
    CREATE or REPLACE PACKAGE BODY CAMPO_PACK as

    PROCEDURE DeleteCode(pCod NUMBER) AS
    BEGIN
    DELETE FROM campo
    WHERE cod = OSDP;
    END DeleteCode;

    END CAMPO_PACK;


    Thanks for the help,
    Anderson



    Published by: user8723300 on 08/13/2009 17:03

    Published by: user8723300 on 08/13/2009 17:04

    I use Oracle SQL Developer

    I know very well of this tool.

    The packet header and body are two separate objects and must be compiled separately. I suspect that the package body is somehow have included in package header and Developer SQL tries to compile all of these at once. You must understand how to compile the header first, then the body. Your code compiles if I use sqlplus. I had to first create the table, so I have included a slash (/) after the packet header and the other after that body. The slash tells sql more to run the buffer (in this case, to compile the object).

    SQL> create table campo (cod number);
    
    Table created.
    
    SQL> CREATE OR REPLACE
      2  PACKAGE CAMPO_PACK AS
      3
      4  TYPE T_CURSOR IS REF CURSOR;
      5
      6  PROCEDURE DeleteCode(pCod NUMBER);
      7
      8  END CAMPO_PACK;
      9  /
    
    Package created.
    
    SQL> CREATE OR REPLACE PACKAGE BODY CAMPO_PACK AS
      2
      3  PROCEDURE DeleteCode(pCod NUMBER) AS
      4  BEGIN
      5  DELETE FROM campo
      6  WHERE cod = pcod;
      7  END DeleteCode;
      8
      9  END CAMPO_PACK;
     10  /
    
    Package body created.
    

    If I remove the slash after the package header, sql more trying to compile all this at once, and I get the same error you get:

    SQL> CREATE OR REPLACE
      2  PACKAGE CAMPO_PACK AS
      3
      4  TYPE T_CURSOR IS REF CURSOR;
      5
      6  PROCEDURE DeleteCode(pCod NUMBER);
      7
      8  END CAMPO_PACK;
      9
     10  CREATE OR REPLACE PACKAGE BODY CAMPO_PACK AS
     11
     12  PROCEDURE DeleteCode(pCod NUMBER) AS
     13  BEGIN
     14  DELETE FROM campo
     15  WHERE cod = pcod;
     16  END DeleteCode;
     17
     18  END CAMPO_PACK;
     19  /
    
    Warning: Package created with compilation errors.
    
    SQL> sho err
    Errors for PACKAGE CAMPO_PACK:
    
    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    9/1      PLS-00103: Encountered the symbol "CREATE"
    
  • PLS-00103: encountered the symbol "VARCHAR2".

    Hi all

    on 11.2.0.4 on Win 2008

    Executing steps I get PLS-00103: encountered the symbol "VARCHAR2":

    DECLARE

    BEGIN

    plsql_block VARCHAR2 (500);

    plsql_block: = ' BEGIN create_dept (:,: b: c: d); END;';

    END;

    /

    ORA-06550: line 3, column 13:

    PLS-00103: encountered the symbol "VARCHAR2" when expecting one of the following conditions:

    := . ( @ % ;

    The symbol ': = ' has been substituted for "VARCHAR2" continue.

    Thank you for helping me see my error.

    Hello

    Variable declaration is declared between the two and start. Personally, I prefer the initialization of variables there.

    DECLARE

    plsql_block VARCHAR2 (40): = ' start create_dept (:,: b: c: d); end;';

    BEGIN

    ...

    You did not request this, but I'm telling you anyway

    I also use declare start the buildings inside the code to make the code more manageable, compact and clear (because I have a short memory, I need to see everything in one small scope at a time). Then, the blocks are easy enough to separate function or procedure if necessary.

    set serveroutput on
    declare
      x number := 0;
    
      procedure step(p1 number) is
      begin
        dbms_output.put_line('Step ' || p1);
      end;
    begin
      step(x);
    
      declare
        y number := x + 1;
      begin
        step(y);
      end;
    
      declare
        z number := x + 2;
      begin
        step(z);
      end;
    
    end;
    /
    
    anonymous block completed
    Step 0
    Step 1
    Step 2
    
  • PLS-00103: encountered the symbol "ACCEPT" in sql * most report

    Hello

    SQL > @Testing.SQL

    Please enter the Deptno: 30

    ACCEPT v_FROM_Date PROMPT ' Please enter the Date(In Format: DD-MON-YYYY) start: '

    *

    ERROR on line 5:

    ORA-06550: line 5, column 1:

    PLS-00103: encountered the symbol "ACCEPT."

    Clear Buffer;
    
    
    SET Heading ON
    SET Verify OFF
    SET Feed OFF
    SET Linesize 5000
    SET Pagesize 2000
    SET Serveroutput ON SIZE 1000000
    
    
    VARIABLE        v_FROM_Date       VARCHAR2(200);
    VARIABLE        v_deptno       NUMBER;
    
    
    Spool Details.txt;
    
    
    --PROMPT Please enter the Deptno: &&v_deptno
    --PROMPT Please enter the Start Date(In Format: DD-MON-YYYY): &&v_From_Date
    ACCEPT v_deptno PROMPT 'Please enter the Deptno: '
    
    
    BEGIN
        :v_deptno := UPPER(NVL(RTRIM(LTRIM('&v_deptno')),0));
    END;
    
    
    ACCEPT v_FROM_Date PROMPT 'Please enter the Start Date(In Format: DD-MON-YYYY): '
    
    
    BEGIN
        :v_From_Date := TO_DATE('&v_From_Date','DD-MON-YYYY');
    END;
    
    
    select empno,ename,sal,hiredate,deptno
    from emp
    where deptno=:v_deptno
    and to_date(hiredate,'DD-MON-YYYY')=:v_From_Date
    /
    
    
    SPOOL OFF;
    

    Thank you

    Rajesh123 wrote:

    1. VARIABLE v_deptno NUMBER;
    2. BEGIN
    3. : v_deptno: = UPPER (NVL (RTRIM (LTRIM ('& v_deptno')), 0));
    4. END;

    Thank you

    The v_deptno variable above is a number data type. So no need to use UPPER LTRIM, RTRIM, functions and why are you using NVL(v_deptno,0)? DeptNo 0 is present in the emp table? If Yes, you can use NVL with 0, otherwise just use any other deptno which is present in the table emp with NVL function.

    Rajesh123 wrote:

    1. Select empno, ename, sal, hiredate deptno
    2. WCP
    3. where deptno =: v_deptno
    4. and to_date (hiredate,'MON-DD-YYYY "") =: v_From_Date
    5. /

    Thank you

    HireDate is already a date data type to the emp table then why you try to convert a date once again. Delete this.

    Check the code of work after all the applied corrections that are not above below.

    Buffer Clear;

    SET the position WE

    SET verify OFF

    SET to power OFF

    SET Linesize 5000

    SET Pagesize 2000

    SET Serveroutput ON SIZE 1000000

    V_FROM_Date VARIABLE VARCHAR2 (200);

    VARIABLE v_deptno NUMBER;

    Reel 'D:\Details.txt ';

    -PROMPT please enter the Deptno: & v_deptno

    -PROMPT please enter the Date(In Format: DD-MON-YYYY) start: & v_From_Date

    ACCEPT v_deptno PROMPT ' Please enter the Deptno: '

    ACCEPT v_FROM_Date PROMPT ' Please enter the Date(In Format: DD-MON-YYYY) start: '

    BEGIN

    : v_deptno: = '& v_deptno ';. -If necessary use NVL ("& v_deptno", 10 (which is present in the emp table))

    : v_From_Date: = '& v_From_Date ';.

    END;

    /

    Select empno, ename, sal, hiredate deptno

    WCP

    where deptno =: v_deptno

    and hiredate = TO_DATE(:v_From_Date,'DD-MON-YYYY');

    /

    SPOOL OFF;

    -Edited as suggested by ascheffer

    Thank you

    Ann

  • Error (34.2): PLS-00103: encountered the symbol "END" when you try to compile the procedure.

    Hello

    I get the following error when I try to compile the procedure. I call a package inside this simple procedure. Not sure where I do worng. Here is the error I get.

    Error (34.2): PLS-00103: encountered the symbol "END"?

    Here is my code

    create or replace PROCEDURE BATCH_JOB_CAC_SP

    (

    vstatus OUT NUMBER)

    AS

    vloadserver global_name.global_name%TYPE: = get_dbservername;

    vuseridmod CONSTANT VARCHAR2 (15): = 'SYSTEM '.

    vloadname CONSTANT VARCHAR2 (30): = "BATCH_JOB_CAC_SP";

    v_cnt_upd NUMBER: = 0;

    vrunid NUMBER;

    v_spoutput VARCHAR2 (150);

    CURSOR job_cac

    IS

    SELECT NumCli, job_cac FROM batch_job_cac, batch_recid, jobnum;

    BEGIN

    I'm in job_cac LOOP

    job_cac_pkg.job_cac_valid_sp (i.custnum, i.jobnum, v_spoutput);

    CASE v_spoutput

    WHEN "1" THEN DBMS_OUTPUT. Put_line ('update job ACC');

    WHEN "2" THEN DBMS_OUTPUT. Put_line ('update job ACC');

    WHEN '3' THEN DBMS_OUTPUT. Put_line ('can not update working ACC');

    OF ANOTHER DBMS_OUTPUT. Put_line (v_spoutput);

    END CASE;

    END LOOP;

    EXCEPTION

    WHILE OTHERS THEN

    IF job_cac % isopen THEN

    CLOSE Job_cac;

    END IF;

    ROLLBACK;

    vStatus: = 1;

    LOG_ERROR_SP_NM (vLoadServer, vLoadName, SQLCODE, SQLERRM, vUserIdMod);

    END;

    END BATCH_JOB_CAC_SP;

    Thanks for your help.

    Hello

    You have 2 statements END at the bottom of your code, but only 1 BEGIN statement earlier.

    Losing one of these END States.

  • Getting error PLS-00103: encountered the symbol "MM".

    SQL > create or replace procedure DIP. Insert_proc is

    2 start

    3 immediately execute "INSERT INTO DIP. RAKS (SELECT * FROM DIP.) RAKS WHERE CREATED BETWEEN to_char (TRUNC (ADD_MONTHS (SYSDATE-1), 'MM'), 'YYYYMMDD') AND to_char (TRUNC (LAST_DAY (ADD_MONTHS (SYSDATE-1))), 'YYYYMMDD')); "

    4 run immediately "COMMITTED";

    5 immediately execute "INSERT INTO DIP. RAKS (SELECT * FROM DIP.) RAKS WHERE CREATED BETWEEN to_char (TRUNC (ADD_MONTHS (SYSDATE-1), 'MM'), 'YYYYMMDD') AND to_char (TRUNC (LAST_DAY (ADD_MONTHS (SYSDATE-1))), 'YYYYMMDD')); "

    6 immediate execution "COMMITTED";

    7 end;

    8.

    CAUTION: Procedure created with compilation errors.

    SQL >

    SQL >

    SQL > show error

    DIP PROCEDURAL errors. INSERT_SIV_SELL_PROC:

    LINE/COL ERROR

    -------- -----------------------------------------------------------------

    3/128 PLS-00103: encountered the symbol "MM" when awaits an of the

    Next:

    * & = - + ; <>/ is mod remains not return rem

    return < an exponent (*) > <>or! = or ~ = > = < = <>and or

    as like2 like4 likec between using | bulk of type multiset

    Member submultiset

    SQL >

    any help appreciated.

    CREATE OR REPLACE PROCEDURE DIP. Insert_proc IS

    BEGIN

    immediately execute "INSERT INTO DIP. RAKS (SELECT * FROM DIP.) RAKS WHERE CREATED BETWEEN to_char (TRUNC (ADD_MONTHS (SYSDATE-1), "MM"), "YYYYMMDD") AND to_char (TRUNC (LAST_DAY (ADD_MONTHS (SYSDATE-1))), "YYYYMMDD"))';

    RUN IMMEDIATELY "COMMITTED";

    immediately execute "INSERT INTO DIP. RAKS (SELECT * FROM DIP.) RAKS WHERE CREATED BETWEEN to_char (TRUNC (ADD_MONTHS (SYSDATE-1), "MM"), "YYYYMMDD") AND to_char (TRUNC (LAST_DAY (ADD_MONTHS (SYSDATE-1))), "YYYYMMDD"))';

    run immediately "COMMITTED";

    end;

    /

    Missing semicolon, I modified the last answer but you picked up before it was visible

  • PLS-00103: encountered the symbol "ALTER".

    I receive he following error when I run this script

    DECLARE
    vcount NUMBER (1);
    BEGIN
    SELECT count (*) IN the all_col_comments vcount
    WHERE owner = 'myUser' and Table_Name = 'table1' and column_name = 'col1 ';
    IF vcount = 0 THEN
    ALTER TABLE myUser.table1
    ADD (col1 varchar2 (1) DEFAULT ' is NOT NULL);
    END IF
    END;

    Error report:
    ORA-06550: line 7, column 4:
    PLS-00103: encountered the symbol "ALTER" when expecting one of the following conditions:

    (begin case declare exit for goto if loop mod null pragma
    raise return select update while < ID >
    < between double quote delimited identifiers of > < a variable binding > < <
    continue the narrow current delete fetch locking insert open rollback
    savepoint sql set run commit forall fusion pipe purge
    The symbol 'lock has been inserted before "ALTER" to continue.
    ORA-06550: line 8, column 11:
    PLS-00103: encountered the symbol "(" quand attend une deles de valeurs suivantes:) "

    , in
    ORA-06550: line 8, column 47:
    PLS-00103: encountered the symbol "NULL" when expected in the following way:

    as like2 like4 likec between Member submultiset
    06550 00000 - "line %s, column % s:\n%s".
    * Cause: Usually a PL/SQL compilation error.

    There is no need to pack the column names in the TOP, the names of the objects are stored by default at the top of case. Isn't that quoted strings must be upper case, but yes, your last block is basically my second block and will correctly find the column already exists when it is executed a second time. Your original, with tiny strings cited would never return a line fomr the query on the column, so would attempt to add the column each time.

    SQL> select table_name, column_name
      2  from all_tab_columns
      3  where owner = 'ops$oracle' and
      4        table_name = 'table1' and
      5        column_name = 'col1';
    
    no rows selected
    
    SQL> select table_name, column_name
      2  from all_tab_columns
      3  where owner = 'OPS$ORACLE' and
      4        table_name = 'TABLE1' and
      5        column_name = 'COL1';
    
    TABLE_NAME                     COLUMN_NAME
    ------------------------------ ------------------------------
    TABLE1                         COL1
    

    See the difference?

    (I only did the drop table so that I can redo the pl/sql block from scratch to show that was) the first time he ran he added the column and b) for subsequent executions, he did not attempt to add the column because it exists, unlike your first display.

    However, scripts that add columns to tables should, in general, not be something that is executed repeatedly. More often by adding a column to a table would be part of a process of controlled upgrade, and most of the time, the fact that a 'new' column already exists in the database before the upgrade seems to indicate a problem with the upgrade process, and probably not something to be ignored in silent mode.

    John

  • PLS-00103: encountered the symbol "PROCÉDURE" when expected

    Hi all

    LINE/COL ERROR

    -------- -----------------------------------------------------------------

    13/5 PLS-00103: encountered the symbol "BEGIN" when expecting one of

    What follows:

    language

    22/4 PLS-00103: encountered the symbol "PROCÉDURE" when expected

    of the following:

    not end up dominant static of final instantiable order pragma

    manufacturer membership card

    The symbol "static" was substituted for "PROCEDURE continue.

    create or replace package xx_extract
    as
    procedure xxc_process;
    procedure xxc_get(in_id     emp.empno%type,
                      in_number emp.deptno%type);
    end ;
    

    create or replace package xx_extract
    as
    cursor v_cursor
    is
    select empno,deptno
      from emp a,dept d
     where e.deptno=d.deptno;
     v_cursor_rec  v_cursor%rowtype;
     v_in_number emp.empno%type;
     v_in_date   emp.hiredate%type;
       procedure xxc_process 
       is
        Begin
            xxc_get(v_cursor_rec.empno,v_cursor_rec.deptno);
             open v_cursor;
           loop
             fetch v_cursor into v_cursor_rec;
             exit when v_cursor%notfound;
           end loop;
        close v_cursor;
       end xxc_process;
       procedure xxc_get(in_id     emp.empno%type,
                         in_number emp.deptno%type)
       is
        begin
         select empno,hiredate
            into v_in_number,v_in_date
           from emp
          where empno=to_char(in_id)
            and deptno=to_char(in_number);
          EXCEPTION
              WHEN NO_DATA_FOUND THEN
                      in_id := NULL;
                      in_number := NULL;
       end xxc_get;
    end xx_extract;
    

    994122 wrote:

    The code below displays all values where I called the procedure before the stmt Open why? Can u please explain.

    PROCEDURE xxc_process

    IS

    BEGIN

    xxc_get (v_cursor_rec.empno, v_cursor_rec.deptno);

    OPEN v_cursor;

    because v_cursor_rec.empno and v_cursor_rec.deptno are empty at this time

    994122 wrote:

    But as suggested as Roger why we named as below? I need the output when I ran the package and I don't want to call (run) as below

    Start

    xx_extract.xxc_process ();

    end;

    the begin... end; box IS running the package, what you do with the create command are CREATION (storage) a package.

  • PLS-00103: encountered the symbol "PREPARE" when expecting one of the following conditions:

    Hello

    Clearly, I'm doing a basic error.

    It is my statement prepared;

    Variable identifier;

    EXEC SQL PREPARE sql_stmt OF ' SELECT order_name, order_status OF orders WHERE order_id <: id; »

    I get the error on execution of the file using @/dir/file.sql

    PLS-00103: encountered the symbol "PREPARE" when awaits an of the

    Next:

    What is the problem?

    concerning

    Sameer

    Yes. You are right. A thorough SQL more guide and modified the SQL for this

    Variable identification number

    VARIABLE order_info REFCURSOR

    Begin

    : id: = 20000;

    Open: order_info to SELECT order_name, order_status OF orders WHERE order_id<>

    End;

    It works fine when it is called from the @/file/file.sql command prompt

    then I print command line order_info

    Thank you

    Sameer

  • PLS-00103: encountered the symbol "end-of-file.

    Hello
    on the 11g R2, I get the following error:
    SQL> declare
      2      m_clob  clob;
      3  begin
      4      select
      5          sql_fulltext
      6      into
      7          m_clob
      8      from
      9          v$sql
     10      where
     11          sql_id = '0cx8yq5fnry'
     12      and child_number = 0
     13      ;
     14
     15      dbms_output.put_line(m_clob);
     16    /
        dbms_output.put_line(m_clob);
                                    *
    ERROR at line 15:
    ORA-06550: line 15, column 33:
    PLS-00103: Encountered the symbol "end-of-file" when expecting one of the
    following:
    ( begin case declare end exception exit for goto if loop mod
    null pragma raise return select update while with
    <an identifier> <a double-quoted delimited-identifier>
    <a bind variable> << continue close current delete fetch lock
    insert open rollback savepoint set sql execute commit forall
    merge pipe purge
    Thanks for help.

    Start
    do something;
    END;
    */*

  • PLS-00103: encountered the symbol "" when expecting one of the following values:

    Hello

    When running under pl/sql block get below error...

    Please advice me where I am wrong

    DECLARE
    T_DATE date: = sysdate-813;
    v_last_closing_book_bal_amt (19: 4) NUMBER: = NULL;
    v_txn_amt (19: 4) NUMBER: = NULL;
    v_max NUMBER (5): = 100;
    NUMBER (5) v_count: = 1;

    BEGIN

    FOR I IN 1.30
    LOOP

    WHILE (v_count < = v_max)
    LOOP
    Insert into AI_ODS_TXN (BANK_BRANCH_ID,ACCT_NO,ISO_CCY_CD,CR_DR_IND,BOOK_DT,VALUE_DT,TXN_KEY,TXN_TYP_DE,TXN_CAT_DE,TXN_CD,TXN_AMT,FUNDS_TYP_CD,RPT_REF_TXT,INSERTED_TS,UPDATED_TS,BANK_ABA_NO,BENE_PARTY_BANK_ID,BENE_PARTY_BANK_NM,BENE_PARTY_BANK_ADDR_LINE1_TXT,BENE_PARTY_BANK_ADDR_LINE2_TXT ,BENE_PARTY_BANK_ADDR_LINE3_TXT,BENE_BANK_ID,BENE_BANK_NM,BENE_BANK_ADDR_LINE1_TXT,BENE_BANK_ADDR_LINE2_TXT,BENE_BANK_ADDR_LINE3_TXT,DETAIL_LINE1_TXT,DETAIL_LINE2_TXT,DETAIL_LINE3_TXT,DETAIL_LINE4_TXT,DETAIL_LINE5_TXT,FED_CLEAR_TS_TXT,CR_DR_PARTY_NM,CR_DR_PARTY_ADDR_LINE1_TXT,CONTROL_NO,INTERMED_BANK_ID ,INTERMED_BANK_NM,INTERMED_BANK_ADDR_LINE1_TXT,INTERMED_BANK_ADDR_LINE2_TXT,INTERMED_BANK_ADDR_LINE3_TXT,ORG_BANK_NM,ORG_BANK_ADDR_LINE1_TXT,ORG_BANK_ADDR_LINE2_TXT,ORG_BANK_ADDR_LINE3_TXT,OGB_BANK_NM,OGB_BANK_ADDR_LINE1_TXT,OGB_BANK_ADDR_LINE2_TXT,OGB_BANK_ADDR_LINE3_TXT,INSTRUCT_BANK_NM,INSTRUCT_BANK_ADDR_LINE1_TXT ,UNCLEAR_DT,UNCLEAR_ITEM_IND,INSTRUCT_AMT,INSTRUCT_CCY_CD,SENDER_CHARGE_LINE1_TXT,SENDER_CHARGE_LINE2_TXT,SENDER_CHARGE_LINE3_TXT,SENDER_CHARGE_LINE4_TXT,REGULATORY_TXT,BANK_REF_TXT,EXT_REF_TXT,YOUR_REF_TXT,FED_DR_ACCT_NO,SWIFT_STMT_NO,NDC_CD,BAI_CD,SWIFT_CD,CNS_SEQ_NO,LOAD_NO,UPDATED_WORKFLOW_NM,EXCHANGE_RT,ORG_BANK_ID ,OGB_BANK_ID,INSTRUCT_BANK_ID,SRC_MSG_TYP,CLEAR_DT,JOURNAL_NO,SERIAL_NO,SWIFT_STMT_DT,CR_DR_TXT,SUPP_DETAIL_TXT,GVC_CD,BOOKING_TXT,ITEM_TYP_DE,ORG_BANK_ACCT_NO,RETURNED_DDT_TXT,DETAIL_LINE6_TXT,DETAIL_LINE7_TXT,DETAIL_LINE8_TXT,DETAIL_LINE9_TXT,DETAIL_LINE10_TXT,DETAIL_LINE11_TXT,DETAIL_LINE12_TXT,DETAIL_LINE13_TXT ,DETAIL_LINE14_TXT,EXTRA_BCS_DETAIL_IND,OGB_BANK_ACCT_NO,INTERMED_BANK_ACCT_NO,CR_FLOOR_LIMIT_AMT,DR_FLOOR_LIMIT_AMT,MT942_TOTAL_CR_AMT,MT942_TOTAL_CR_NO,MT942_TOTAL_DR_AMT,MT942_TOTAL_DR_NO,INTERIM_FINAL_TXN_IND) values ('DBBRUSSELS','825-0004665-47','EUR','C',to_timestamp(v_date,'DD-MON-RR HH.MI. SSXFF AM'), to_timestamp (T_DATE,' DD-MON-RR HH.MI.) SSXFF AM'), '2009102201521911232172' + v_count, "TRANSFER", "TRANSFER of FUNDS", "SWF", 100, "VT", "I000424906808216", to_timestamp (T_DATE,' DD-MON-RR HH.MI.) SSXFF AM'), to_timestamp (T_DATE,' DD-MON-RR HH.MI.) SSXFF AM'), null, null, null, null, "AAAAA35AAHNLEITEN GMBH", null, null, null, null, null, null,'IHR KT 0000002056/200000044 ', 4 NR.5100000835 09.03.09/N','ETTOBTR. NR.510000', ' 0872 6.627,01 10.03.09/NETTOBTR. 4', 559, 21 NR.5100000891 11.03', null, null, null, null, null, null, null, null, null, "DUROPACK AG 1235 WIEN", "XXN33XXXXROHNLEITEN GMBH", null, null, null, null, null, null, null, null, null, ' n, null, null, null, null, null, null, null, ' PET326000108PAGE AND ', 'I000424906808216', 'I000424906808216', null,' 102/1 ', null, 195, 'TRF', null, 0, "w_MT940_PROC - Type: first STMT ', 0, '15150', null, null, '940', null , null, null, to_timestamp (T_DATE,' DD-MON-RR HH.MI.) (SSXFF AM'), 'C', null, '051', ' GUTSCHRIFT ELEKTRON. ", '76VB', '501057590',"QQQ34DQQQROHNLEITEN GMBH ", 09/NETTOBTR. 5.093,33 NO.5 ',' 100000899/12.03.09/NETTOBT','R. 2.302,58 NR.5100000917 / 13.03.09/NETTOBTR «,» (831,37 no, 'R.5100001006 2', null, null, null, null, null, null,' n, null, null, null, null, null, null, 'F');
    COMMIT;

    v_count: = v_count + 1;

    END LOOP;





    Select nvl(last_closing_book_bal_amt,0) in the v_last_closing_book_bal_amt of ai_ods_acct_tbl
    WHERE ACCT_NO = 825-0004665-47' AND BANK_BRANCH_ID = 'DBBRUSSELS' AND ISO_CCY_CD = "EUR";

    Select nvl (sum (txn_amt), 0) in the v_txn_amt of ai_ods_txn
    WHERE ACCT_NO = 825-0004665-47' AND BANK_BRANCH_ID = 'DBBRUSSELS' AND ISO_CCY_CD = 'EUR' and book_dt = to_timestamp (T_DATE,' DD-MON-RR HH.MI.) SSXFF AM');



    Insert into ai_ods_BOOK_dt_agg (BANK_BRANCH_ID, ACCT_NO, ISO_CCY_CD, BOOK_DT, TOTAL_DR_ITEM_NO, TOTAL_DR_AMT, TOTAL_CR_ITEM_NO, TOTAL_CR_AMT, INSERTED_TS, UPDATED_TS) values ('DBBRUSSELS', 825-0004665-47', "EUR", to_timestamp (T_DATE,' DD-MON-RR HH.MI.)) SSXFF AM'), 0,0,4, v_txn_amt, to_timestamp (T_DATE,' DD-MON-RR HH.MI.) SSXFF AM'), to_timestamp (T_DATE,' DD-MON-RR HH.MI.) SSXFF AM'));
    Insert into ai_ods_value_dt_agg (BANK_BRANCH_ID, ACCT_NO, ISO_CCY_CD, VALUE_DT, TOTAL_DR_ITEM_NO, TOTAL_DR_AMT, TOTAL_CR_ITEM_NO, TOTAL_CR_AMT, INSERTED_TS, UPDATED_TS) values ('DBBRUSSELS', 825-0004665-47', "EUR", to_timestamp (T_DATE,' DD-MON-RR HH.MI.)) SSXFF AM'), 0,0,4, v_txn_amt, to_timestamp (T_DATE,' DD-MON-RR HH.MI.) SSXFF AM'), to_timestamp (T_DATE,' DD-MON-RR HH.MI.) SSXFF AM'));
    Insert into ai_ods_CATEGORY_agg (TXN_CAT_DE, BANK_BRANCH_ID, ACCT_NO, ISO_CCY_CD, BOOK_DT, TOTAL_DR_ITEM_NO, TOTAL_DR_AMT, TOTAL_CR_ITEM_NO, TOTAL_CR_AMT, INSERTED_TS, UPDATED_TS) values ("TRANSFER of FUNDS", "DBBRUSSELS", 825-0004665-47', "EUR", to_timestamp (T_DATE,' DD-MON-RR HH.MI.)) SSXFF AM'), 0,0,4, v_txn_amt, to_timestamp (T_DATE,' DD-MON-RR HH.MI.) SSXFF AM'), to_timestamp (T_DATE,' DD-MON-RR HH.MI.) SSXFF AM'));

    Insert into ai_ods_acct_bal (BANK_BRANCH_ID,ACCT_NO,ISO_CCY_CD,BOOK_DT,INTERIM_FINAL_BAL_IND,LOAD_NO,BOOK_BAL_AMT,VALUE_BAL_AMT,COLLECTED_BAL_AMT,TOTAL_DR_AMT,TOTAL_CR_AMT,TOTAL_CHECK_CR_AMT,TOTAL_LBX_AMT,TOTAL_IMPREST_DR_AMT,TOTAL_IMPREST_CR_AMT,ONE_DAY_FLOAT_AMT,TWO_DAY_FLOAT_AMT,THREE_DAY_FLOAT_AMT ,FOUR_DAY_FLOAT_AMT,MTD_AVG_COLLECTED_BAL_AMT,YTD_AVG_COLLECTED_BAL_AMT,INSERTED_TS,UPDATED_TS,UPDATED_WORKFLOW_NM,OPEN_BOOK_BAL_AMT,SWIFT_STMT_DT,SWIFT_STMT_NO,MISSING_STMT_IND,SRC_MSG_TYP,TAG_60F_DT,TAG_60F_AMT,STMT_TYPE_IND) values ('DBBRUSSELS','825-0004665-47','EUR',to_timestamp(v_date,'DD-MON-RR HH.MI. SSXFF AM'), 'F', 0, v_last_closing_book_bal_amt + v_txn_amt,.
    v_last_closing_book_bal_amt + v_txn_amt, 0, 0, v_txn_amt, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, to_timestamp (T_DATE,' DD-MON-RR HH.MI.) SSXFF AM'), to_timestamp (T_DATE,' DD-MON-RR HH.MI.) SSXFF AM'), ' w_MT940_PROC - Type: first STMT ", v_last_closing_book_bal_amt, to_timestamp (T_DATE,' DD-MON-RR HH.MI.) (SSXFF AM'),' 102/1 ', ', '940', to_timestamp (17 April 09 ',' DD-MON-RR HH.MI.) SSXFF AM'), v_last_closing_book_bal_amt, '=');
    COMMIT;

    T_DATE: = sysdate-809;
    T_DATE: = T_DATE + I;
    v_count: = 1;

    END LOOP;
    END;
    /


    ERROR
    *=====*

    T_DATE date: = sysdate-813;
    ***
    ERROR on line 2:
    ORA-06550: line 2, column 7:
    PLS-00103: encountered the symbol "" when expecting one of the following values:
    constant exception < an ID >
    * < a double-quoted delimited identifiers > table double Fedya Ref *.
    char time timestamp interval date binary national character
    NCHAR

    Hello

    First of all, you said T_DATE as DATE data type

    v_date                                      date := sysdate -813;
    

    And then you try to use a timestamp like this

    to_timestamp(v_date,'DD-MON-RR HH.MI.SSXFF AM'),
    

    T_DATE's DATE, not VARCHAR2.

    You should try CAST to convert the TIMESTAMP DATE. Or. first convert the VARCHAR2 DATE, then by TIMESTAMP.

    Kind regards

  • PLS-00103: encountered the symbol

    Hello
    in 10g R2, what's wrong with my code:
    SQL> DECLARE
      2   my_task_name VARCHAR2(30);
      3   my_sqltext   CLOB;
      4  BEGIN
      5   my_sqltext := 'SELECT m.tablespace_name,        m.used_percent,         (m.tablespace_size - '                      ||
      6                 'm.used_space)*t.block_size/1024/1024 mb_free  FROM  dba_tablespace_usage_metrics m, dba_tablespaces t' ||
      7                 'WHERE :1 != 'BASIC'    AND t.tablespace_name = m.tablespace_name';
      8
      9   my_task_name := DBMS_SQLTUNE.CREATE_TUNING_TASK(
     10           sql_text    => my_sqltext,
     11           bind_list   => sql_binds(anydata.ConvertNumber(100)),
     12           user_name   => 'SCOTT',
     13           scope       => 'COMPREHENSIVE',
     14           time_limit  => 60,
     15           task_name   => 'my_sql_tuning_task',
     16           description => 'Task to tune a query on a specified employee');
     17  END;
     18  /
                   'WHERE :1 != 'BASIC'    AND t.tablespace_name = m.tablespace_name';
                                 *
    ERROR at line 7:
    ORA-06550: line 7, column 30:
    PLS-00103: Encountered the symbol "BASIC" when expecting one of the following:
    * & = - + ; < / > at in is mod remainder not rem
    <an exponent (**)> <> or != or ~= >= <= <> and or like LIKE2_
    LIKE4_ LIKEC_ between || member SUBMULTISET_
    The symbol "* was inserted before "BASIC" to continue.
    Thanks for the help.

    You have a string in quotation marks in a quoted string.

    Whenever you do this, you need to double the inner quotes.

    SQL> select 'where blah != 'BASIC' and' from dual;
    select 'where blah != 'BASIC' and' from dual
                                *
    ERROR at line 1:
    ORA-00923: FROM keyword not found where expected
    
    SQL> select 'where blah != ''BASIC'' and' from dual;
    
    'WHEREBLAH!=''BASIC''AND'
    -------------------------
    where blah != 'BASIC' and
    
  • PLS-00103: encountered the symbol "create".

    "I have a code below for which I get an error: 17/2 PLS-00103: encountered the symbol"create""

    I copied the code of a manual and annot figure out why it doesn't work.
    Plase help, thanks :)


    ============================
    create or replace package course_pkg AS
    type course_rec_typ IS RECORD
    (name, student.first_name%TYPE,
    student.last_name%type last_name,
    course_no course.course_no%type,
    Description course.description%type,
    section_no section.section_no%type
    );
    type course_cur is ref cursor return course_rec_typ;

    procedure get_course_list
    (p_student_id NUMBER,
    p_instructor_id NUMBER,
    course_list_cv IN OUT course_cur);
    end course_pkg;

    create or replace package body course_pkg AS
    procedure get_course_list
    (p_student_id NUMBER,
    p_instructor_id NUMBER,
    course_list_cv IN OUT course_cur)
    is
    Start
    If p_student_id is null and p_instructor_id
    is null then
    Open the course_list_cv for
    Select 'Please choose a student -' first_name,
    'combination instructor' last_name,.
    Course_no NULL,
    Description NULL,
    Section_no NULL
    Double;
    elsif p_student_id is null then
    Open the course_list_cv for
    Select first_name s.first_name
    s.last_name last_name,
    c.course_no course_no,
    description of the c.Description,
    se.section_no section_no
    instructor, I, s student, section se, courses, e-registration

    where i.instructor_id = p_instructor_id
    and i.instructor_id = se.instructor_id
    and se.course_no = c.course_no
    AND e.student_id = s.student_id
    AND e.section_id = se.section_id
    order of c.course_no, se.section_no;

    elsif p_instructor_id is NULL then
    Open the course_list_cv for
    Select first_name i.first_name
    i.last_name last_name,
    c.course_no course_no,
    description of the c.Description,
    se.section_no section_no
    Instructor, I, s student, section se, courses, e-registration

    where s.student_id = p_student_id
    AND e.instructor_id = se.instructor_id
    and se.course_no = c.course_no
    and e.student_id = s.student_id
    and e.section_id = se.section_id

    order of c.course_no, se.section_no;

    END IF;
    END get_course_list;
    end course_pkg;

    /

    In the code you posted, you have only 1 slash - at the end of the package body.

    You must compile the spec and body separately.

    They can be in the same script file if you wish, but there must be a slash after the spec code and once after the code of the organization.

Maybe you are looking for