Error in Compiling Procedure within a Procedure ?

I am currently using oracle 11g, and I am getting the error when compiling the following procedure.
Please adv, what am I missing?
If a remove the following lines, then procedure is compiled.
BEGIN
BEGIN my_ctx_procedure(MSHOLD_CODE);
END;
Thanks a lot.
Luqman
create or replace PROCEDURE TEST1
(FDATE1 DATE, FDATE2 DATE,MSHOLD_CODE IN VARCHAR)
IS
BEGIN
BEGIN my_ctx_procedure(MSHOLD_CODE);
END;
CURSOR c1 IS
SELECT * from sholders
where SHOLD_CODE IN
(select * from IN_LIST);
BEGIN
OPEN C1;
END TEST1;
ERROR
LINE/COL ERROR
7/8 PLS-00103: Encountered the symbol "C1" when expecting one of the
following:
:= . ( @ % ;

What exactly are you trying to do?
run the my_ctx_procedure(MSHOLD_CODE) proc prior to opening the cursor?
If so:
create or replace PROCEDURE TEST1
(FDATE1 DATE, FDATE2 DATE,MSHOLD_CODE IN VARCHAR)
IS
  CURSOR c1 IS
    SELECT * from sholders
    where SHOLD_CODE IN
    (select * from IN_LIST);
BEGIN
  my_ctx_procedure(MSHOLD_CODE);
  OPEN C1;
END TEST1;
/Your error comes because you put BEGIN and then tried to declare a cursor. You can't declare an explicit cursor inside the main bit of the code; you have to do it in the declaration section (ie. the bit between DECLARE / CREATE Procedure ... IS and the BEGIN)
Edited by: Boneist on 10-Jul-2009 11:31
I suggest you read through this: http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28370/toc.htm to gain a better understanding of PL/SQL

Similar Messages

  • Call a procedure within a Procedure

    hi
    How can i call a procedure within a procedure
    Thanks in advance

    SQL> create procedure b as
      2  begin
      3  null;
      4  end;
      5  /
    Procedure created.
    SQL> create procedure a as
      2  begin
      3  b;
      4  end;
      5  /
    Procedure created.
    SQL>

  • Calling a oracle procedure within a procedure - Urgent

    Hi
    Can some one tell me, how to call a oracle procedure within a procedure ?
    Thanks
    Murali

    You could always try looking in the manuals.

  • Executing procedure within same  procedure

    Hi all,
    Can any one tell me what would be happen if execute procedure within same procedure.
    Example :
    create or replace procedure print(str in varchar2)
    is
    begin
    print(str);
    dbms_output.put_line(str);
    exception
    when others then
    null;
    end print ;
    Regards,
    P Prakash

    But, you could call the same procedure in recursion procedure.
    This kind of procedure has :
    1) action of the recursion procedure
    2) condition to go out from the same recursive procedure
    SQL> create or replace procedure print(str in varchar2) is
      2      num_letters natural;
      3      string_tmp  varchar2(50);
      4  begin
      5      --  recursion action
      6      dbms_output.put_line(str);
      7 
      8      -- recursion condition
      9      num_letters := nvl(length(str), 0);
    10      if num_letters > 0 then
    11          print(substr(str, 1, num_letters - 1));
    12      end if;
    13  end print;
    14  /
    Procedure created
    SQL> exec  print('abcdefghijkl');
    abcdefghijkl
    abcdefghijk
    abcdefghij
    abcdefghi
    abcdefgh
    abcdefg
    abcdef
    abcde
    abcd
    abc
    ab
    a
    PL/SQL procedure successfully completed
    SQL>

  • Calling package procedure within another procedure ???

    Hello ,
    I have package called import_pack, within this i have procedure called import_proc. I have another separate procedure called main_proc.
    Now i want to call import_proc in main_proc. how do i do this ???
    Any example would be great. Thank you so much.

    Hi,
    If the import_pack package is in the user_x schema, then the following will always work:
    user_x.import_pack.import_proc (...);If main.proc is also in the user_x schema, then the owner name is optional, so this would be acceptable, too:
    import_pack.import_proc (...);If main_proc is in the same package, then the package name is optional, so this would also work:
    import_proc (...);

  • Procedure within procedure problem

    Hi
    I have a table of 5 different magazines and a table of purchases of those magazines. I have written a procedure to take the details of a given magazine and place the sales for a given month into a sales table as follows:
    create or replace procedure monthly_sales(mag number, startdate date, enddate date) is
    magtotal number(7,0);
    magprice magazine.unitprice%type;
    magsales number(7,2);
    begin
    select count(p.magid), m.unitprice into magtotal, magprice from purchase p, magazine m where p.datepurchased between startdate and enddate and p.magid = mag and m.magid=p.magid
    group by m.unitprice;
    magsales := magtotal*magprice;
    insert into sales values(startdate, mag, magtotal, magsales);
    end;
    What I would like to do though is have a procedure that you just need to run once and it will enter the sales for a given month for all magazines into the sales table. My thought was to try to do this using procedures within a procedure as follows:
    create or replace procedure monthly_sales(startdate date, enddate date) is
    magtotal number(7,0);
    magprice magazine.unitprice%type;
    magsales number(7,2);
    procedure mag1 is
    begin
    select count(p.magid), m.unitprice into magtotal, magprice from purchase p, magazine m where p.datepurchased between startdate and enddate and p.magid = 1 and m.magid=p.magid
    group by m.unitprice;
    magsales := magtotal*magprice;
    insert into sales values(startdate, 1, magtotal, magsales);
    end mag1;
    procedure mag2 is
    begin
    select count(p.magid), m.unitprice into magtotal, magprice from purchase p, magazine m where p.datepurchased between startdate and enddate and p.magid = 2 and m.magid=p.magid
    group by m.unitprice;
    magsales := magtotal*magprice;
    insert into sales values(startdate, 2, magtotal, magsales);
    end mag2;
    procedure mag3 is
    begin
    select count(p.magid), m.unitprice into magtotal, magprice from purchase p, magazine m where p.datepurchased between startdate and enddate and p.magid = 3 and m.magid=p.magid
    group by m.unitprice;
    magsales := magtotal*magprice;
    insert into sales values(startdate, 3, magtotal, magsales);
    end mag3;
    procedure mag4 is
    begin
    select count(p.magid), m.unitprice into magtotal, magprice from purchase p, magazine m where p.datepurchased between startdate and enddate and p.magid = 4 and m.magid=p.magid
    group by m.unitprice;
    magsales := magtotal*magprice;
    insert into sales values(startdate, 4, magtotal, magsales);
    end mag4;
    begin
    select count(p.magid), m.unitprice into magtotal, magprice from purchase p, magazine m where p.datepurchased between startdate and enddate and p.magid = 5 and m.magid=p.magid
    group by m.unitprice;
    magsales := magtotal*magprice;
    insert into sales values(startdate, 5, magtotal, magsales);
    end;
    However, when I run this it is ignoring all the procedures within the main procedure and just entering the results for magazine 5. I'm at a loss as to why this isn't working, is this even the correct way to go about it? any help would be greatly appreciated
    thanks

    Why doing it the hard way?
    A single insert statement will do the trick.
    I made a bit of a guess as to the structure of your tables:
    create table magazine (magid number primary key, unitprice number);
    create table purchase (magid number references magazine(magid), datepurchased date);
    create table sales (startdate date, magid number references magazine(magid), magtotal number, magsales number);
    insert into magazine(magid, unitprice) values (1, 3.95);
    insert into magazine(magid, unitprice) values (2, 4.95);
    insert into magazine(magid, unitprice) values (3, 3.50);
    insert into magazine(magid, unitprice) values (4, 6.0);
    insert into magazine(magid, unitprice) values (5, 5.50);
    insert into purchase(magid, datepurchased) values (1, sysdate);
    insert into purchase(magid, datepurchased) values (1, sysdate);
    insert into purchase(magid, datepurchased) values (2, sysdate);
    insert into purchase(magid, datepurchased) values (2, sysdate);
    insert into purchase(magid, datepurchased) values (2, sysdate);
    insert into purchase(magid, datepurchased) values (4, sysdate);
    insert into purchase(magid, datepurchased) values (5, sysdate);
    insert into purchase(magid, datepurchased) values (5, sysdate);
    insert into purchase(magid, datepurchased) values (5, sysdate);
    insert into purchase(magid, datepurchased) values (5, sysdate);
    commit;
    create or replace procedure monthly_sales(p_startdate in date, p_enddate in date)
    is
    begin
      insert into sales (startdate, magid, magtotal, magsales)
        select p_startdate
        ,      p.magid
        ,      count(p.magid)
        ,      count(p.magid) * m.unitprice
        from   purchase p
          join magazine m on m.magid = p.magid
        where  p.datepurchased between p_startdate and p_enddate
        group by p.magid
        ,        m.unitprice;
    end;
    begin
      monthly_sales(trunc(sysdate,'MM'), last_day(trunc(sysdate,'MM')));
    end;
    select * from sales;
    STARTDATE      MAGID   MAGTOTAL   MAGSALES
    01-JAN-11          1          2        7.9
    01-JAN-11          2          3      14.85
    01-JAN-11          4          1          6
    01-JAN-11          5          4         22

  • Error while compiling trigger/procedure for a table in which attribute is r

    I have table
    desc pappu
    name varchar(10);
    start varchar(5);
    end varchar(5);
    One of the attribute is end which is also a reserved keyword in oracle.I want to create some procedure/trigger which use the attribute end but i get errors while compiling that "
    PLS-00103: Encountered the symbol "END" when expecting one of the
    following:
    <an identifier> <a double-quoted delimited-identifier>
    The symbol "<an identifier> was inserted before "END" to
    continue.
    Any workaround for this.

    user620101 wrote:
    name varchar(10);
    start varchar(5);
    end varchar(5);
    SQL> create table pappu (name varchar(10),stat varchar(5),end varchar(5));hi,
    earlier you have given column name start and here you are creating table with colum name stat....anyway try to use column alias for column END
    CREATE TABLE pappu (NAME VARCHAR(10),STAT VARCHAR(5),END VARCHAR(5));
    INSERT INTO PAPPU ( NAME, STAT, END ) VALUES ( 'name1', '1', '14');
    INSERT INTO PAPPU ( NAME, STAT, END ) VALUES ( 'name2', '15', '20');
    CREATE OR REPLACE PROCEDURE testpappu
    AS
    CURSOR test1
    IS
    SELECT NAME,stat AS st,END AS v_end FROM pappu;
    BEGIN
         FOR i IN test1
         LOOP
         DBMS_OUTPUT.PUT_LINE ( 'name - '||i.NAME ||'-'||i.st||'-'||i.v_end );
         END LOOP;
    END;
    SQL> exec testpappu;
    name - name1-1-14
    name - name2-15-20
    PL/SQL procedure successfully completed.
    Thnx
    MB
    Edited by: ManishB on Sep 20, 2010 10:50 AM

  • Calling a stored procedure within a package

    We have a number of packages containing stored procedures. In an existing production application, we used embedded SQL in C programs to call these stored procs
    e.g.
    EXEC SQL EXECUTE
    BEGIN owner.fees_calc.some_fee(:parm1,...);
    END;
    END-EXEC;
    Now, I am trying to use SQLJ to call this same stored proc in the package. However, I am getting a compilation error from sqlj saying that it cannot find a stored procedure or function of that name. It works fine if I use a stored proc that is not in a package.
    So how do I call a stored procedure within a package? Or is this not currently possible with sqlj?
    I am also getting a warning just before the error and I'm wondering if the error is being caused by this:
    Warning: You are using an Oracle JDBC driver, but connecting to a non-Oracle database. SQLJ will perform JDBC-generic SQL checking.
    I am connecting to an Oracle 7.3.3 database using an Oracle 7.3.4 JDBC driver. I also tried using the Oracle 8.0.5 JDBC driver for the same database but I get the same warning message.

    I used the following code to call a stored
    procedure via SQLJ:
    try {
    #sql [iCtx] {
    CALL ibs.cvs_validate.validate_port_id(:IN record_id ,:IN poe_pod_flag,:IN port_id,:OUT error_code,:OUT error_message) };
    where
    "ibs" is the schema
    "cvs_validate" is the package
    "validate_port_id" is the procedure
    The code runs fine, but to get it to compile
    in JDeveloper 2.0, I had to disable the "Check SQL semantics against database schema" option on the Project Properties (SQLJ) property sheet.
    null

  • Function call in procedure within Package Body

    I am a novice in PL/SQL so that I can't find out where the problem is. I am testing a function call in procedure within a Package Body.
    But the PL/SQL Complier doesn't compile the package body but I don't know what I do wrong. Plz let me know how to call a function in procedure within a Package Body?
    Here are the Packaget test programs..
    CREATE OR REPLACE PACKAGE manage_students
    IS
    PROCEDURE find_sname;
    PROCEDURE find_test;
    PROCEDURE find_test_called;
    FUNCTION GET_LASTMT
    RETURN SEQUENCE_TEST.SEQ_NO%TYPE;
    END manage_students;
    CREATE OR REPLACE PACKAGE BODY manage_students AS
    v_max_nbr SEQUENCE_TEST.SEQ_NO%TYPE;
    PROCEDURE find_sname
    IS
    BEGIN
    BEGIN
    SELECT MAX(SEQ_NO)
    INTO v_max_nbr
    from SEQUENCE_TEST;
    DBMS_OUTPUT.PUT_LINE('MAX NUMBER is : '||v_max_nbr);
    EXCEPTION
    WHEN OTHERS
    THEN DBMS_OUTPUT.PUT_LINE('Error in finding student_id: ');
    RETURN;
    END;
    COMMIT;
    EXCEPTION
    WHEN OTHERS
    THEN DBMS_OUTPUT.PUT_LINE('Error in finding student_id: ');
    END find_sname;
    PROCEDURE find_test
    IS
    BEGIN
    BEGIN
    DBMS_OUTPUT.PUT_LINE('MAX NUMBER Called from another procedure : '||v_max_nbr);
    EXCEPTION
    WHEN OTHERS
    THEN DBMS_OUTPUT.PUT_LINE('Error in finding student_id: ');
    RETURN;
    END;
    COMMIT;
    EXCEPTION
    WHEN OTHERS
    THEN DBMS_OUTPUT.PUT_LINE('Error in finding student_id: ');
    END find_test;
    FUNCTION GET_LASTMT
    RETURN SEQUENCE_TEST.SEQ_NO%TYPE
    IS
    v_max_nbr SEQUENCE_TEST.SEQ_NO%TYPE;
    BEGIN
    SELECT MAX(SEQ_NO)
    INTO v_max_nbr
    from SEQUENCE_TEST;
    RETURN v_max_nbr;
    EXCEPTION
    WHEN OTHERS
    THEN
    DECLARE
    v_sqlerrm VARCHAR2(250) :=
    SUBSTR(SQLERRM,1,250);
    BEGIN
    RAISE_APPLICATION_ERROR(-20003,
    'Error in instructor_id: '||v_sqlerrm);
    END;
    END GET_LASTMT;
    PROCEDURE find_test_called
    IS
    BEGIN
    BEGIN
    V_max := Manage_students.GET_LASTMT;
    DBMS_OUTPUT.PUT_LINE('MAX_NUMBER :'|| V_max);
    EXCEPTION
    WHEN OTHERS
    THEN DBMS_OUTPUT.PUT_LINE('Error in finding student_id: ');
    RETURN NULL;
    END;
    COMMIT;
    EXCEPTION
    WHEN OTHERS
    THEN DBMS_OUTPUT.PUT_LINE('Error in finding student_id: ');
    END find_test_called;
    END manage_students;
    DECLARE
    v_max SEQUENCE_TEST.SEQ_NO%TYPE;
    BEGIN
    manage_students.find_sname;
    DBMS_OUTPUT.PUT_LINE ('Student ID: Execute.');
    manage_students.find_test;
    manage_students.find_test_called;
    END;
    -----------------------------------------------------------------------------------------------

    Hi,
    Welcome to the forum!
    You'll find that there are a lot of people willing to help you.
    Are you willing to help them? Whenever you have a problem, post enough for people to re-create the problem themselves. That includes CREATE TABLE and INSERT statements for all the tables you use.
    Error messages are very helpful. Post the complete error message you're getting, including line number. (It looks like your EXCEPTION sections aren't doing much, except hiding the real errors. That's a bad programming practice, but probably not causing your present problem - just a future one.)
    Never post unformatted code. Indent the code to show the extent of each procedure, and the blocks within each one.
    When posting formatted text on this site, type these 6 characters:
    \(all small letters, inside curly brackets) before and after each section of formatted test, to preserve the spacing.
    For example, the procedure find_test_called would be a lot easier to read like this:PROCEDURE find_test_called
    IS
    BEGIN
         BEGIN
              V_max := Manage_students.GET_LASTMT;
              DBMS_OUTPUT.PUT_LINE ('MAX_NUMBER :' || V_max);
         EXCEPTION
              WHEN OTHERS
              THEN
                   DBMS_OUTPUT.PUT_LINE ('Error in finding student_id: ');
                   RETURN      NULL;
         END;
         COMMIT;
    EXCEPTION
         WHEN OTHERS
         THEN
              DBMS_OUTPUT.PUT_LINE ('Error in finding student_id: ');
    END find_test_called;
    It's much easier to tell from the code above that you're trying to return NULL from a procedure.  Only functions can return anything (counting NULL); procedures can have RETURN statements, but that single word"RETURN;" is the entire statement.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to call CLOB to BLOB conversion function within stored procedure?

    I have a tiny APEX application from which I need to be able to print. I’ve used these two resources: (Is there an inexpensive APEX report printer for invoices/checks/statements? and http://download.oracle.com/docs/cd/E14373_01/appdev.32/e13363/up_dn_files.htm#CJAHDJDA)
    I guess that in order to be able to download the RTF document stored in CLOB, I need to convert it into BLOB. I’ve found this function for this purpose on Oracle forums:
    CREATE OR REPLACE FUNCTION     c2b( c IN CLOB ) RETURN BLOB
    -- typecasts CLOB to BLOB (binary conversion)
    IS
              pos PLS_INTEGER := 1;
              buffer RAW( 32767 );
              res BLOB;
              lob_len PLS_INTEGER := DBMS_LOB.getLength( c );
    BEGIN
         DBMS_LOB.createTemporary( res, TRUE );
         DBMS_LOB.OPEN( res, DBMS_LOB.LOB_ReadWrite );
    LOOP
         buffer := UTL_RAW.cast_to_raw( DBMS_LOB.SUBSTR( c, 16000, pos ) );
         IF          UTL_RAW.LENGTH( buffer ) > 0
         THEN
                   DBMS_LOB.writeAppend( res, UTL_RAW.LENGTH( buffer ), buffer );
         END IF;
         pos := pos + 16000;
         EXIT WHEN pos > lob_len;
    END LOOP;
    RETURN res; -- res is OPEN here
    END c2b;And I am trying to use it in the modified download procedure that I also have found on Oracle forums:
    CREATE OR REPLACE PROCEDURE DOWNLOAD_WO(v_id IN NUMBER)
    AS
            v_mime          VARCHAR2(48);
            v_length     NUMBER;
            v_file_name     VARCHAR2(2000):= 'WO_Download.rtf';
            lob_loc          CLOB;
              v_blob      BLOB;
              v_company        jobs_vw.company%TYPE;
              v_project        jobs_vw.project%TYPE;
              v_description     jobs_vw.description%TYPE;
              v_date_          jobs_vw.date_%TYPE;
              v_job_no          jobs_vw.job_no%TYPE;
              v_apqwo               jobs_vw.apqwo%TYPE;
    --          v_mime           VARCHAR2(48) := 'application/msword';
    BEGIN
            SELECT     mime_type, report, DBMS_LOB.GETLENGTH(report)
              INTO     v_mime,lob_loc,v_length
              FROM     report_layouts
              WHERE     rl_id = 22332925279634283;
    -- JOB_VW record:
        SELECT     job_no
                   ,date_
                   ,description
                   ,apqwo
                   ,project
                   ,company       
         INTO     v_job_no
                   ,v_date_
                   ,v_description
                   ,v_apqwo
                   ,v_project
                   ,v_company
         FROM     jobs_vw
         WHERE     id = 214;
    -- Replace holders with actual values:
        lob_loc := REPLACE(lob_loc, '#COMPANY#', v_company);
        lob_loc := REPLACE(lob_loc, '#PROJECT#', v_project);
        lob_loc := REPLACE(lob_loc, '#DESCRIPTION#', v_description);
        lob_loc := REPLACE(lob_loc, '#DATE_#', TO_CHAR(v_date_, 'DD/MM/YYYY'));
        lob_loc := REPLACE(lob_loc, '#JOB_NO#', v_job_no);
        lob_loc := REPLACE(lob_loc, '#APQWO#', v_apqwo);
                  -- set up HTTP header
                        -- use an NVL around the mime type and
                        -- if it is a null set it to application/octect
                        -- application/octect may launch a download window from windows
                        owa_util.mime_header( nvl(v_mime,'application/octet'), FALSE );
                    -- set the size so the browser knows how much to download
                    htp.p('Content-length: ' || v_length);
                    -- the filename will be used by the browser if the users does a save as
                    htp.p('Content-Disposition:  attachment; filename="'||replace(replace(substr(v_file_name,instr(v_file_name,'/')+1),chr(10),null),chr(13),null)|| '"');
                    -- close the headers           
                    owa_util.http_header_close;
                    -- download the BLOB
    --                wpg_docload.download_file( Lob_loc );
                             v_blob := c2b(lob_loc);
                             wpg_docload.download_file( v_blob );
    end DOWNLOAD_WO;
    /Unfortunately when I try to compile the download_wo stored procedure I am getting this error:
    Error at line 64: PL/SQL: Statement ignoredThe 64th line is:
    v_blob := c2b(lob_loc);How should I correctly call c2b within download_wo? Any advice is greatly appreciated.
    Thank you for your time.
    Daniel

    Hello there,
    Well, its invalid :(
    Object C2B is Invalid. I didn't know since when I run the create ... function, I only get this feedback:
    Statement processed.
    0.19 secondsI am investigating.
    Daniel

  • PL/SQL: Executing a procedure from within another procedure

    Hello, I'm a newbie and I need help on how to execute procedures from within another procedure. The procedure that I call from within the procedure have return values that I want to check.
    I tried: EXECUTE(user_get_forum_info(p_forumid, var_forum_exists, var_forum_access, var_forumname));
    but I get the error message:
    PLS-00103: Encountered the symbol "USER_GET_FORUM_INFO" when expecting one of the following::= . ( @ % ; immediate
    The symbol ":=" was substituted for "USER_GET_FORUM_INFO" to continue.
    And when I tried: EXECUTE(user_get_forum_info(p_forumid, var_forum_exists, var_forum_access, var_forumname));
    I get the error message:
    PLS-00222: no function with name 'USER_GET_FORUM_INFO' exists in this scope
    PL/SQL: Statement ignored
    The procedure USER_GET_FORUM_INFO exists. (don't understand why it says "no FUNCTION with name", it's a procedure I'm executing)
    I'm stuck so thanks for any help...
    Below is all the code. I'm using Oracle 9i on RedHat Linux 7.3.
    ================================================================================
    CREATE OR REPLACE PROCEDURE user_forum_requestsaccess (
    p_forumid IN NUMBER,
    p_requestmessage IN VARCHAR2
    AS
    var_forumid NUMBER;
    var_forum_exists NUMBER;
    var_forum_access NUMBER;
    request_exists NUMBER;
    var_forumname VARCHAR2(30);
    FORUM_DOESNT_EXIST EXCEPTION;
    FORUM_USER_HAS_ACCESS EXCEPTION;
    FORUM_REQUEST_EXIST EXCEPTION;
    BEGIN
    SELECT SIGN(NVL((SELECT request_id FROM forum.vw_all_forum_requests WHERE forum_id = p_forumid AND db_user = user),0)) INTO request_exists FROM DUAL;
    EXECUTE(user_get_forum_info(p_forumid, var_forum_exists, var_forum_access, var_forumname));
    IF var_forum_exists = 0 THEN
    RAISE FORUM_DOESNT_EXIST;
    ELSIF var_forum_access = 1 THEN
    RAISE FORUM_USER_HAS_ACCESS;
    ELSIF request_exists = 1 THEN
    RAISE FORUM_REQUEST_EXIST;
    ELSE
    INSERT INTO tbl_forum_requests VALUES (SEQ_TBL_FORUM_REQ_REQ_ID.NEXTVAL, SYSDATE, p_requestmessage, p_forumid, user);
    INSERT INTO tbl_forum_eventlog VALUES (SEQ_TBL_FORUM_EVNTLOG_EVNT_ID.NEXTVAL,SYSDATE,1,'User ' || user || ' requested access to forum ' || var_forumname || '.', p_forumid,user);
    COMMIT;
    END IF;
    EXCEPTION
    WHEN
    FORUM_DOESNT_EXIST
    THEN RAISE_APPLICATION_ERROR(-20003,'Forum doesnt exist.');
    WHEN
    FORUM_USER_HAS_ACCESS
    THEN RAISE_APPLICATION_ERROR(-20004,'User already have access to this forum.');
    WHEN
    FORUM_REQUEST_EXIST
    THEN RAISE_APPLICATION_ERROR(-20005,'A request to this forum already exist.');
    END;
    GRANT EXECUTE ON user_forum_requestsaccess TO forum_user;
    ================================================================================
    Regards Goran

    you don't have to use execute when you want to execute a procedure (only on sql*plus, you would use it)
    just give the name of the funtion
    create or replace procedure test
    as
    begin
        dbms_output.put_line('this is the procedure test');
    end test;
    create or replace procedure call_test
    as
    begin
        dbms_output.put_line('this is the procedure call_test going to execute the procedure test');
        test;
    end call_test;
    begin
        dbms_output.put_line('this is an anonymous block calling the procedure call_test');
        call_test;
    end;
    /

  • Syntax for delete statement within a procedure

    within a procedure i tried to delete the table using
    delete table tablename;
    but it is showing error that
    PL/SQL: SQL Statement ignored
    PL/SQL: ORA-00903: invalid table name
    whether we have to use execute immediate delete table tablename;
    or this syntax is correct

    Hi ,
    i think if you want to use the delete
    then it shld be delete from tablename --> this'll delete all rows
    but if u want to use execute immediate then you might as well use TRUNCATE --> provided you need not have these data written to the log file (if you need for recovery later better use DELETE)
    i.e EXECUTE IMMEDIATE ('TRUNCATE TABLE tbl_name');
    hope this helps

  • Using stored procedures within Crystal Reports

    Hello all,
    Background Information:
    I am trying to teach myself how to execute a stored procedure within Crystal Reports.  This is an aspect of Crystal that my work group has not utilized before and we're trying to gather information on the subject.  We use Oracle to create and execute functions and procedures all the time, but I've never tried this within Crystal.
    I use the "Add Command" functionality within Crystal on most of my reports so that I can taylor the sql to the report.  I find this easier to do versus using the ODBC connection to the tables and writing the code through the Crystal Reports wizard.  I also frequently use functions within these sql statements that are inserted in the Add Command.
    What I'm trying to achieve:
    I have a report that needs to run as a "trial", and then later as a committed "run".  This is for a monthly billing system.  Essentially, the user will run the report as the "trial", preview the data, make any necessay corrections, and then later, run the actual billing run.  Within my application, the bills are not actually marked as "billed" until they are actually "billed', if that makes sense.  As a result, the "trial" report will need to mark the bills as "billed", generate the report, and then rollback the data (so that the bills are not "billed".  Once the actual billing reports are ran, the same report will run, but with a "commit" at the end of the report so that the bills are now "billed".
    I'm trying simple tests and failing (i.e. taking baby steps to learn what capabilities Crystal has):
    I created as simple of a procedure as I can envision.  This procedure inserts the word "test" in one of my fields for a provided account number.  When I try to run this procedure via Crystal (via New Report ->History->My ODBC Database link->Stored Procedures), Crystal asks for the account number parameter, as it should.  But I then receive the error message:
    Database Connector Error: '42000:[Microsoft][ODBC driver for Oracle]Syntax error or access violation'
    The existing ODBC connection has work great for years and years to retrieve data from tables, but this is the first time I've tried to utilize procedures.  Can anybody help?  And can anybody explain what the Stored Procedures link is supposed to do?  Am I going down the right path?
    thanks,
    Noel

    Hello,
    Make sure the Oracle client install path is in the PATH statement. And also make sure you are using an IN/OUT cursor. CR only reads the last SELECT statement. Search the Documents area on how to create a Stored Procedure.
    Also, if you are using CR XI ( 11.0 ) then upgrade to CR XI R2 and apply all service packs ( SP 6 ). Go to this link: http://www.sdn.sap.com/irj/boc and download the trial version of CR XI R2 and use your XI keycode, then apply the patches which you can get to by clicking on the BusinessObjects tab above, then Downloads.
    Direct link to the Trial version: http://www.sap.com/solutions/sapbusinessobjects/sme/freetrials/index.epx
    It may fix your issue also.
    Thanks again
    Don

  • How to compile Oracle java strored procedure in Putty

    I have created a java strored procedure , which would be invoked by oracle function.
    This java stored procedure is get compiled via SQL plus. While compiling by the use of putty , it shows lots of compilation error .
    How to compile Oracle java strored procedure in Putty??

    You'll need to add the j2ee.jar to your classpath. Usually you'll have to add some jars from your app server to your classpath as well.
    For example (using weblogic):
    javac -classpath c:\java\j2ee\j2ee1.3.1\lib\j2ee.jar;c:\tools\appserver\weblogic\wl7.1\lib\weblogic.jar
    HelloServlet.java

  • Sp_executesql vs transaction statement within Stored Procedure

    Experts,
    Any difference between sp_executesql vs Transaction/Commit statement or try/catch block within Stored Procedure?
    What is the best practice to use and why?
    Thank You
    Regards,
    Kumar
    Please do let us know your feedback. Thank You - KG, MCTS

    Your question is a bit strange. sp_executesql is used for dynamic SQL. Unless the problem demands dynamic SQL and, therefore, sp_executesql, there is no need to use it.
    For a single statement I would not use transaction and try/catch. For multiple statements you do need to use transaction. It's up to you if you want to use try/catch in the SP or not and trap the error in the client application.
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

Maybe you are looking for

  • Creative Cloud and Master Collection CONFLICT.

    I had first subscribed to Photoshop on the Cloud, then when the Black Friday sale came along I unsubscribed from that and subscribed to the full Creative Cloud for the same price. Then I got the Master Collection on disc, so I unsubscribed from the C

  • Balances Carry Forward.

    Dear Folks, I had carry forwarded the balances of last fiscal year to this fiscal year. Later by mistake i had carry forwarded my balances to last year. now my balance sheet is showing wrong balances. (i.e. our fiscal year is reporting year. currentl

  • Is is possible to open event lists from different tracks at the same time in Logic Pro 9?

    Is it possible to open event lists from two difference tracks in an arrangement at the same time in Logic Pro 9? When I switch between tracks the event list swiches as well. Thanks in advance.

  • Question to Swing Pros: Resizing of JFrame only with visible Rectangular  ?

    Hello folks, quite below is the quoted text message is from Java Substance Forum: http://www.nabble.com/Removing-top-left-substance-menu-and-deactivating-Background-painting-while-Resizing-a-Frame--to17775101.html Is it somehow possible to use substa

  • My mail trash bin disappeared

    So... My mail application has an Inbox folder, a Sent folder and I used to have a trash icon there too, and it disappeared. My email service is comcast.net and now when I delete any message it's just gone no questions asked. The question is two-fold: