PLSQL procedure is not running

Dears
I'm new in PLSQL, I tried to make one procedure but its not working, script is below, its very simple programe but I don not know why is not working, kindly tell me where I made mistake
SET SERVEROUTPUT ON
CREATE OR REPLACE PROCEDURE EDW_STG.STG_TIME_DIMENSION AS
DECLARE
Strat_Year NUMBER := 2005;
End_Year NUMBER := 2010;
Calculate_Year Number :=0;
loop_Year Number :=0;
BEGIN
FOR loop_Year IN Start_Year..End_Years
LOOP
Calculate_Year := Calculate_Year+1;
DBMS_OUTPUT.PUT_LINE(Calculate_Year);
END LOOP;
END STG_TIME_DIMENSION;
=====================================
after ciomplinng error is comming
Error: ORA-00922: missing or invalid option
Thanks in Advance
Ali

Thats becuase you are trying to execute SET sql command along with PLSQL code.
Check this:
SQL> ed
Wrote file afiedt.buf
  1  SET SERVEROUTPUT ON
  2  CREATE OR REPLACE PROCEDURE EDW_STG.STG_TIME_DIMENSION AS
  3  DECLARE
  4  Strat_Year NUMBER := 2005;
  5  End_Year NUMBER := 2010;
  6  Calculate_Year Number :=0;
  7  loop_Year Number :=0;
  8  BEGIN
  9  FOR loop_Year IN Start_Year..End_Years
10  LOOP
11  Calculate_Year := Calculate_Year+1;
12  DBMS_OUTPUT.PUT_LINE(Calculate_Year);
13  END LOOP;
14* END STG_TIME_DIMENSION;
15  /
SET SERVEROUTPUT ON
ERROR at line 1:
ORA-00922: missing or invalid option
SQL> Try this:
SQL> SET SERVEROUTPUT ON
-- then try
SQL> ed
Wrote file afiedt.buf
  1  CREATE OR REPLACE PROCEDURE STG_TIME_DIMENSION AS
  2  Start_Year NUMBER := 2005;
  3  End_Years NUMBER := 2010;
  4  Calculate_Year Number :=0;
  5  loop_Year Number :=0;
  6  BEGIN
  7  FOR loop_Year IN Start_Year..End_Years
  8  LOOP
  9  Calculate_Year := Calculate_Year+1;
10  DBMS_OUTPUT.PUT_LINE(Calculate_Year);
11  END LOOP;
12* END STG_TIME_DIMENSION;
SQL> /
Procedure created.
SQL> Edited by: AP on Aug 10, 2010 5:22 AM

Similar Messages

  • Some procedure can not run,Please help

    --Please Help me where is wrong
    --The Procedure can be compiler,but can not run
    --Maybe there has some wrong with Ref Cursor or dynamic SQL
    --Please,Thanks ver much
    --Follow is my full code
    Create or Replace package ref_types
    AS
    TYPE ref_cursor is REF CURSOR;
    End;
    Create or Replace package userinfo as
    procedure Get_usermenu (baduser out boolean,
    menu out ref_types.ref_cursor
    End;
    Create or Replace package body userinfo as
    procedure Get_usermenu (baduser out boolean,
    menu out ref_types.ref_cursor
    ) is
    v_sqltext varchar2(100);
    v_sql varchar2(300);
    begin
    baduser:=FALSE;
    v_sqltext:='''A001'',''A002'',''A003''';
    v_sql:='select MENUID,P_NAME from MENU_LIST
    where MENUID in (';
    v_sql:=v_sql||v_sqltext||) order by MENUID asc';
    --explain:Get v_sqktext values overpass some process
    open menu FOR v_sql;
    end;
    end;
    /

    thanks,
    error number is : Ora-01001
    I use it In Form:
    declare
    v_baduser boolean;
    v_menu ref_types.ref_cursor;
    v_menuid number;
    v_menuname varchar2(50);
    v_menucount number;
    begin
    v_menucount:=1;
    userinfo.Get_usermenu(v_baduser,v_menu);
    loop
    fetch v_menu into v_menuid,v_menuname;
    exit when v_menu%NOTFOUND;
    show_alert_info(v_menuid||';'||v_menucount||'、'||v_menuname);
    --show_alert_info,like Developer's Function "message",
    --It can show some text
    v_menucount:=v_menucount+1;
    end loop;
    Close v_menu;
    end;

  • One Procedure is not running in the Package

    In my package i have
    Variable assignment - > Procedure -> Interface ( a loop )
    When i am running it , the Procedure is not executing.
    I do not know why .
    Can you help me in this.
    Thanks

    That's right. You need to specify the first step, that'll be fist to execute. Also you could run direct step (helpful for debugging).

  • Stored Procedure Does Not Run Properly When Called From Portlet

    We have a simple Java portlet that calls a PL/SQL stored procedure which we wrote. The stored procedure sends a large number of emails to users in our corporation using the "utl_smtp" package. The stored procedure returns a count of the emails back to the Java portlet when it's finished. This number is displayed in the portlet.
    Our problem:
    The stored procedure functions as expected when run from a PL/SQL block in SQL*Plus, and the Java portlet calls the procedure properly when sending out a smaller number of emails (Less than 200 usually). When we get into a higher number of emails the procedure hangs when called from the portlet, but it STILL functions properly from SQL*Plus. It does not return the number of emails sent
    and the Java portlet is unable to return a SQLException. Also, we have noticed that emails are sent at a much slower pace from the stored procedure when it's called from the portlet.

    Any Ideas?

  • The procedure is not running no compilatin error please help

    Dear Sir,
    I have this procedure, when I am trying to execute it, it shows me busy cursor nothing happens i was trying for 6 hours nothing happening.
    I am not able to trace out what is happening
    please help
    regards
    sanat
    CREATE OR REPLACE procedure rate_Calc is
    --declare
    sdate date := to_date('01-04-2004','dd-mm-yyyy');
    edate date := sysdate;
    p_amt number;
    d_amt number;
    i_qty number;
    r_qty number;
    d_qty number;
    d_rate number;
    aa number;
    begin
    delete from avg_rate;
    commit;
    insert into avg_rate(select to_date('31-03-2004','dd-mm-yyyy'), item_mast.item_code, item_mast.curr_rate from item_mast);
    for rec1 in (select item_code from item_mast
    ) loop
    sdate := to_date('01-04-2004','dd-mm-yyyy');
    while (sdate < edate ) loop
    begin
    select nvl(sum(qty_accepted),0) into r_qty from rece_mast a, rece_det b where a.tran_no = b.tran_no and
    a.tran_date < sdate and item_code = rec1.item_code;
    exception when no_data_found then r_qty := 0;
    when others then r_qty := 0;
    end;
    begin
    select nvl(sum(issue_qty),0) into i_qty
    from issu_mast a, issu_det b where a.tran_no = b.tran_no and
    a.tran_date < sdate and item_code = rec1.item_code;
    exception when no_data_found then i_qty := 0;
    when others then i_qty := 0;
    end;
    begin
    select nvl(item_rate * (r_qty - i_qty),0) into p_amt from avg_rate
    where item_code = rec1.item_code and avg_date = sdate -1 ;
    exception when no_data_found then p_amt := 0;
    when others then p_amt := 0;
    end;
    begin
    select nvl(sum(qty_accepted * item_rate),0), nvl(SUM(qty_accepted),0) into d_amt, d_qty
    from rece_mast a, rece_det b where a.tran_no = b.tran_no and
    a.tran_date = sdate and item_code = rec1.item_code;
    exception when no_data_found then d_amt := 0;d_qty:=0;
    when others then d_amt := 0;d_qty:=0;
    end;
    begin
    d_rate := (p_amt + d_amt) / (r_qty + d_qty - i_qty);
    exception when value_error then
    d_rate := 0;
    when others then
    d_rate:=0;
    end;
    insert into avg_rate (avg_date, item_code, item_rate) values (sdate, rec1.item_code,d_rate);
    sdate := sdate +1;
    end loop;
    end loop;
    commit;
    end;
    /

    Two possibilities:
    1. Some other process is using the avg_rate table and the delete statement is having to wait until that other process is finished.
    2. There is so much to do that it will take several hours to finish. How many rows are in item_mast? Because for every row in item_mast you are inserting over 2000 rows into avg_rate. Also do rece_mast and issu_mast have an index on item_code? If not you're doing a full table scan on those tables for every row you insert into avg_rate. Do rece_det and issu_det have indexes on tran_no? If not then you're doing a full table scan on those for every row you insert.
    So if there are 1 million rows in item_mast, you're inserting 2 billion rows into avg_rate. And if this is not the first time it's been run you're also deleting 2 billion rows. That could take a lot longer than 6 hours.

  • Client to run the plsql procedure web page

    Hi,
    From the pc client of windows 98 I want to browse the web page which created by the plsql procedure on the windowsNT OF ORACLE SERVER DATABE 8.0.5 WITH ORACLE APPLICATION SERVER.
    I used the internet explorer from the client but I failed
    But when I browse thru the server it is running.
    How to use the client to run the plsql procedure to display its web page thru the TCP/IP (LAN NETWORK)???

    Hi
    Browsers do not allow you to communicate with the computer except in a very limited way, and accessing files to run them is a definite no, which if you think about it is a sensible approach otherwise there is nothing to stop anyone opening any file/app on a persons computer, (it can be done by getting your user to download and approve the installation of a small 'interface' program, which is what hackers also do to gain control of a computer).
    An alternative may be to create an air of flex app to do this that requires connection to your server in order to play.
    PZ

  • Running Plsql procedure using shell script

    Dear All,
    Dear All,
    I have to generate reports weekly by using a plsql procedure.
    For Exapmle : My Proc name is Weekly_report(i number).
    Here i is the argument for which i need to run the proc 7 times as follows
    exec weekly_report(1)
    exec weekly_report(2)
    exec weekly_report(3)
    exec weekly_report(4)
    exec weekly_report(5)
    exec weekly_report(6)
    exec weekly_report(7)
    I need to run them parallely at a time so that time taken will be less. Is there any way doing this through shell script.
    Thanks in asdvance.

    damorgan wrote:
    I can't think of anything in the Oracle world left in the dustbin of history I miss less than shell scripts.
    Why work in another language, why work in a tool that is non-portable, why have to deal with SysAdmins when dbms_scheduler is many times more capable?
    Definitely DBMS_SCHEDULER. Shell scripting is obsolete with perhaps only a few very rare exceptions.+1: shell scripts suck.
    DBMS_Scheduler allows you to setup the report procedures as programs that are executed at the same time in a single job (as steps in a scheduler chain). you can also setup email confirmation based on them successfully completing. All good stuff and not difficult to do.

  • PLSQL WANTS TO RUN  WINDOWS PROGRAM FROM PLSQL PROCEDURE

    WANTS TO RUN WINDOWS PROGRAM FROM PLSQL PROCEDURE.
    I want to run EXE file from pl/sql program , i have tried host it does
    work in pl/sql .
    Is there any Solution to this problem
    Thank you

    Hi,
    It sounds like what you are trying to do, is run one mapping in a pre-mapping process of another mapping. You use a wrapper that implements sqlplus_exec_template.sql in PL/SQL. Is that correct?
    I don't think that by the way you execute this mapping, it ends up in the context of the process flow. The reason is because according to Warehouse Builder the mapping is being invoked standalone (through the wrapper that implements the template). As a result, the context in which Warehouse Builder would log the messages is lost.
    What I suggest you do (assuming I understand the problem correctly), is run the mapping as a separate mapping in the process flow. Because in the current release we do not support passing output parameters in the process flow, you will have to (temporarily) store the results of the first mapping in a table and pick it up from there in the other mapping. In the next major release (autumn 2004) we will support passing parameters between activities.
    Thanks,
    Mark.

  • Business Event not triggering the PLSQL procedure.. What to do?

    We need to call a plsql procedure when the GL Approval workflow has ended with approval. I thought i could do this by customizing the relevant business event.
    We are on EBS 12.1.3 with RDBMS : 11.2.0.3.0.
    I saw that the business event oracle.apps.gl.Journals.journal.approve was disabled currently. I enabled it and created a subscription for it. Subscription was a PLSQL procedure. Currently, for test purpose only thing it is doing is to insert a row into a table.
    Business Event Subscription settings:
    System: ORDEBS.SYSTEM.COM
    Triggering Event
    Source Type:Local
    Event Filter: oracle.apps.gl.Journals.journal.approve
    Execution Condition
    Phase: 100
    Status: Enabled
    Rule Data: Message
    Action Type:Custom
    On Error: Stop and Rollback
    Action
    PL/SQL Rule Function: XX_GL_APPROVE_BE_PKG.Get_Attributes
    Priority: Normal
    Documentation (Not sure what value to be given for these. I went with the below values.)
    Owner: Company Name
    Owner Tag: Custom Schema
    Using the below query i can see that the business event is getting called when the approval happens (One row added each time approval happened). But I cant see any rows in the table where it should insert a row. What could be going wrong? How can i verify that the procedure has been called?
    select * from WF_DEFERRED where corrid ='APPS:oracle.apps.gl.Journals.journal.approve'
    Procedure:
    CREATE OR REPLACE PACKAGE BODY APPS.XX_GL_APPROVE_BE_PKG
    AS
    PROCEDURE Get_Attributes
    IS
    BEGIN
    INSERT INTO xx.xx_test_table VALUES ('From BE');
    COMMIT;
    END Get_Attributes;
    END XX_GL_APPROVE_BE_PKG;

    Thanks Alejandro. Now this is working.
    Changes i made:
    1. Added the WFERROR workflow as a subscription to this event. So i could see that the function i am calling from the event did not have proper signature.
    2. Changed the function signature to have standard parameters like:
    CREATE OR REPLACE PACKAGE BODY XX_GL_APPROVE_BE_PKG
    AS
    function subscription(p_subscription_guid in raw,
    p_event in out nocopy wf_event_t) return varchar2 is
    l_result varchar2(20);
    begin
    insert into xxvtv.xxvtv_test_table values ('From BE');
    commit;
    exception
    when others then
    wf_core.context('XX_GL_APPROVE_BE_PKG','function subscription', p_event.getEventName(), p_event.getEventKey());
    wf_event.setErrorInfo(p_event, 'ERROR');
    return 'ERROR';
    end subscription;
    END XX_GL_APPROVE_BE_PKG;
    3. Changed the owner name and owner tag both to the custom schema name (XX)

  • I was going to upgrade from 10.6.8 to mavericks 10.9.2, but the installer program notified me stating my appleworks 6 app will not run on the new set up. is there a procedure to keep or switch my documents in order to obtain the mavericks upgrade?

    i was going to upgrade from 10.6.8 to mavericks 10.9.2, but the installer program notified me stating my appleworks 6 app will not run on the new set up. is there a procedure to keep or switch my documents in order to obtain the mavericks upgrade?

    I can't say personally since I never used AW, but see if these articles help:
    http://www.macworld.com/article/1166370/open_old_docs.html
    http://www.cultofmac.com/248546/convert-system-os-9-appleworks-6-files-to-os-x-p ages-files-os-x-tips/
    I suggest that you clone your current drive with 10.6.8 to an external drive. If you have any issues after upgrading to Mavericks, you can boot back into 10.6.8.
    Both of these applications can be used to create a clone. If you need help creating your clone, let us know.
    SuperDuper! http://www.shirt-pocket.com/
    CCC http://www.bombich.com/download.html

  • Apache PLSQL is not running

    Hi Gurus,
    EBiz: 11.5.10.2
    DB: 10.2.0.4
    ===================================================
    adapcctl.sh version 115.55
    Apache Web Server Listener :httpd ( pid 5824 ) is running.
    Apache Web Server Listener (PLSQL) is not running.
    adapcctl.sh: exiting with status 1
    ===================================================
    Sometimes when users are able to login they are getting Following Error:
    APP-FND-01564: ORACLE error 6550 in afpoload
    ORA-6550:line 1,column 29
    and whey they are after few minutes they are able to login.
    But I want to solve this issue permanently.
    ++++++++++++++++++++++++++++++++++++++++++++++++++++
    from error_log_pls.1308787200: getting following error.
    httpd_pls.pid overwritten -- Unclean shutdown of previous Apache run?
    Kindly help me.
    Regards,
    Raj
    Edited by: user12029911 on Jun 23, 2011 9:04 AM

    I m still facing the problem.
    Error from error_log.1308873600 logfile:
    [Fri Jun 24 09:03:44 2011] [error] [client 3.235.170.190] File does not exist: .....comn/java/oracle/apps/media/oracle/apps/media/splash.gif
    [Fri Jun 24 09:03:44 2011] [error] [client 3.235.170.190] File does not exist: .....comn/java/oracle/apps/media/oracle/apps/media/splash.gif
    [Fri Jun 24 09:03:54 2011] [error] [client 3.235.170.190] client denied by server configuration: .....comn/java/oracle/jdbc
    [Fri Jun 24 09:04:26 2011] [error] [client 3.235.170.190] File does not exist: .....comn/java//
    [Fri Jun 24 09:04:26 2011] [error] [client 3.235.170.190] File does not exist: .....comn/java/oracle/apps/media/oracle/apps/media/splash.gif
    [Fri Jun 24 09:04:27 2011] [error] [client 3.235.170.190] File does not exist: .....comn/java/oracle/apps/media/oracle/apps/media/splash.gif
    [Fri Jun 24 09:19:22 2011] [error] [client 3.235.168.177] File does not exist: .....comn/java//
    [Fri Jun 24 09:20:54 2011] [error] [client 3.235.168.177] File does not exist: .....comn/java/oracle/apps/media/mail.gif
    [Fri Jun 24 09:46:52 2011] [error] [client 3.235.170.190] File does not exist: .....comn/java/oracle/apps/media/mail.gif
    [Fri Jun 24 09:47:15 2011] [error] [client 3.235.170.190] File does not exist: .....comn/java/oracle/apps/media/mail.gif
    are these errors common.
    Regards,
    Raju

  • PP Procedure is Missing, Can not Run the Preprocessor

    hi experts,
    while executing some module program through TCODE. I got this error  PP Procedure is Missing, Can not Run the Preprocessor
    can any one help me ?
    thanks,
    nag.

    Hello,
    What I thought you meant when you said "Port" was that you were using a Distribution project to move it to other machines.  Therefore you have two options to proceed.
    1)  Copy the nicppaiu.dll from the system folder on your machine to the system folder on another machine you are "Porting" to.
    2)  Add a project to your solution that is a Setup project.  Then add the output of your application to this project and add the MSM discussed earlier.  This will create a MSI that can be used to install your application on multiple machines (it still requires a NI-DAQmx install).
    There is a good topic in our help named "Deploying Measurement Studio Applications" that tells you everything you need to know.
    Regards,
    Jeff

  • FOR XML will not run in stored procedure but will in Query

    The following is the Query and stored procedure for a XML export.  The query runs find and returns a clickable link. The stored procedure does not.
    Stored Procedure
    USE [db]
    declare @XmlOutput1 xml
    set @XmlOutput1 =
    (SELECT incident_num,
    unit_id, unit_status_datetime,
    unit_status_remarks
    FROM unit_status_hist
    where convert(varchar,unit_status_datetime,102)
    =
    convert(varchar,getdate(),102)
    FOR XML
    RAW)
    select @XmlOutput1
    Query:
    use db
    SELECT incident_num, unit_id,
    unit_status_datetime,  unit_status_remarks
    FROM unit_status_hist
    WHERE  convert(varchar,unit_status_datetime,102)
    =
    convert(varchar,getdate(),102)
    for XML
    auto, Elements
    Any help would be greatly appreciated.  Thank you.

    The following is the Query and stored procedure for a XML export.  The query runs find and returns a clickable link. The stored procedure does not.
    Stored Procedure
    USE [db]
    declare @XmlOutput1 xml
    set @XmlOutput1 =
    (SELECT incident_num,
    unit_id, unit_status_datetime,
    unit_status_remarks
    FROM unit_status_hist
    where convert(varchar,unit_status_datetime,102)
    =
    convert(varchar,getdate(),102)
    FOR XML
    RAW)
    select @XmlOutput1
    Query:
    use db
    SELECT incident_num, unit_id,
    unit_status_datetime,  unit_status_remarks
    FROM unit_status_hist
    WHERE  convert(varchar,unit_status_datetime,102)
    =
    convert(varchar,getdate(),102)
    for XML
    auto, Elements
    Any help would be greatly appreciated.  Thank you.
    I cant see any stored procedure here
    both of the code posted are queries only
    also clickable link will come in only SSMS query window. Are you trying to execute this from some application?
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Apache Web Server Listener (PLSQL) is not running!!!

    adapcctl erroring out with message "Apache Web Server Listener (PLSQL) is not running." after a simple apache bounce
    EBS 11.5.10.2
    [applmgr@naoes04 naprod]$ adapcctl.sh start
    adapcctl.sh version 115.55
    Apache Web Server Listener is not running.
    Starting Apache Web Server Listener (dedicated HTTP) ...
    Apache Web Server Listener (PLSQL) is not running.
    Starting Apache Web Server Listener (dedicated PLSQL) ...
    adapcctl.sh: exiting with status 0
    [applmgr@naoes04 naprod]$ adapcctl.sh status
    adapcctl.sh version 115.55
    Apache Web Server Listener :httpd ( pid 19447 ) is running.
    Apache Web Server Listener (PLSQL) is not running.
    adapcctl.sh: exiting with status 1

    1. Check adapcctl.sh log file
    2. It was working before? If yes what changed?
    3. Did you change apps password?1. No noticeable entry in adapcctl log except this
    +05/24/12-06:46:02 :: adapcctl.sh version 115.55+
    +05/24/12-06:46:02 :: Apache Web Server Listener :httpd ( pid 30453 ) is running.+
    +05/24/12-06:46:02 :: Apache Web Server Listener (PLSQL) is not running.+
    +05/24/12-06:46:02 :: adapcctl.sh: exiting with status 1+
    +================================================================================+
    +05/24/12-06:46:17 :: adapcctl.sh version 115.55+
    +05/24/12-06:46:17 :: Apache Web Server Listener :httpd ( pid 30453 ) is running.+
    +05/24/12-06:46:17 :: Apache Web Server Listener (PLSQL) is not running.+
    +05/24/12-06:46:17 :: adapcctl.sh: exiting with status 1+
    +===============================================================================+
    2. It was working before, nothing was changed
    3. Nope, I did not change the apps password
    I have already tried those steps
    Apache Web Server Listener (PLSQL) is not running.
    adapcctl.sh: exiting with status 1
    Edited by: 928983 on 24-May-2012 05:23

  • SSRS Suddenly Not Running Stored Procedures

    My problem is affecting multiple reports. They have all been working until recently. Suddenly any parameter that is fed via a stored procedure is not working. Parameters fed via direct query work just fine. I'm lost as to what the cause could be.

    Have the DBA monitor with SQL Profiler:  
    SQL Server Profiler
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

Maybe you are looking for

  • New version of JDev causing JNDI problems

    We just upgraded to the newest Developer Preview of JDEV and all of a sudden client code that compiled and ran fine under the old version is no longer running. I'm guessing something changed in the libraries, but I'm not sure what and why this is occ

  • Error while running OAF Page from Jdevloper9i -SECURITY_APPL_USER_NOTAUTH

    Hi Folks, I am facing the following error when I am running the OAF page from Jdeveloper 9i. I have checked the dbc file, responsibility key and id, Username and pwd. Everything is fine. But even I am getting this error. Please help me how to resolve

  • IPad cannot be synced.  An unknown error occurred (1140).

    brand new iPad Powerbook G4 Leopard 10.5.8 iPhoto 6.0.6 I am getting this error message: "The iPad "Robert's iPad" cannot be synced. An unknown error occurred (1140)." The problem seems to be my iPhoto library, which contains 2611 photos. When I go u

  • Macbook keeps forgetting mail password on restart

    Why does my macbook pro lose mail password, go to default wallpaper, load calendar when I restart or turn on my computer? How can I fix this?

  • DEV 6i and oracle home

    Please can anybody help? Perhaps a minor problem but when i try to install dev6i release 2 (just downloaded)i have to specify a oracle home. When a choose the one where i have installed the 9i database (orahome90) then i get the following error: The