Results 1 to 4 of 4

Thread: procedure block

  1. #1
    Join Date
    Feb 2004
    Posts
    5

    Question Unanswered: procedure block

    SET serveroutput on
    set verify off

    accept yourname prompt 'Please enter any word:'

    declare

    name varchar2(100) :='&yourname';

    procedure parse_name (fullname IN OUT varchar2)
    IS

    begin

    fullname varchar2(100) :=name;

    fullname_in varchar2(100) :=ltrim(rtrim(fullname));

    dbms_output.put_line(fullname_in);

    end;
    /

    I think..I am confused on procedure block..
    would you please how I can correct this code??

  2. #2
    Join Date
    Feb 2004
    Location
    India
    Posts
    6
    hey i thnk u need to declare ur variables after the procedure signature and before the begin. then later do the assignement inside the begin block. contemplating only.

  3. #3
    Join Date
    Feb 2004
    Location
    India
    Posts
    5

    answer to ur query !!

    _create or replace procedure_x as
    ___ name varchar2(100) ;
    ___ procedure xx (fullname IN OUT varchar2)
    ___ IS
    ___________ fullname_in varchar2(100);
    ___ begin
    ___________fullname_in :=ltrim(rtrim(fullname));
    ___________ dbms_output.put_line(fullname_in);
    ___ end XX;
    _begin
    _name :='&yourname';
    _xx(name);
    _end;

    Hope this helps !!
    reply back if have more problems !!
    Thanks
    Sang_Garg

  4. #4
    Join Date
    Nov 2003
    Location
    down on the cube farm, left then right then another left
    Posts
    467
    There you go again asking people to fix your code rather than asking what is wrong.

    In PL/SQL blocks the procedure/function statement is equivalent to the DECLARE statement. IF YOU READ THE DOCUMENTATION http://download-west.oracle.com/docs...oview.htm#7106 (page 1 I might add) you would find out that variable declarations always come after a {declare} statement and before the BEGIN. When you read about functions/procedure you will find that they do not use a declare
    NOTE: Please disregard the label "Senior Member".

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •