Shrink file (log) from within a procedure

I'd like to incorporate the DBCC shrinkfile command to my maintenance procedure. This procedure gets called after I've finished my weekly importing process. I only need to shrink the log files as almost all the modifications are either a record update or
an insert (there are very few deletions done). I need to do this across several databases and for software maintainability would prefer to have only the one procedure.
My issue is that there does not seem to be a way to point to the various databases from within a procedure to preform this operation. Also the maintenance plan modules have a shrink database operation but I don't see a shrink file operation so that doesn't
appear to be an option.
Have I overlooked something or is it not possible to preform a shrink file operation for the transaction log files for multiple databases?
Developer Frog Haven Enterprises

Thank you for your response. While I did not use your answer verbatim it did lead me to my solution as I only need to preform the shrink operation on 4 out of the 7 databases in my SQL instance.
FYI my final solution was...
-- shrink the log files
DECLARE @sql
nvarchar(500);
SET @sql
=
'USE [vp]; DBCC SHRINKFILE (2, 100);';
EXEC
(@sql);
SET @sql
=
'USE [vp_arrow]; DBCC SHRINKFILE (2, 100);';
EXEC
(@sql)
Developer Frog Haven Enterprises

Similar Messages

  • Create a text file output from within a procedure

    I can output to a file from within SQL+ using the spool command but how do I do this from within a procedure?
    I have got a table called ABC and want to output columns A and B to a new text file based on variables pased through when the procedure is run, the name of the text file should be generated from a sequence?
    Any info appreciated.
    Cheers
    Cliff

    Hi,
    U can use UTL_File Package, But the only constraint is it will write the file only on the server m/c and not on the client m/c.
    Regards
    Gaurav

  • Running unix commands from within a procedure

    Oracle 11.1, AIX 6.1
    ================
    A developer would like to know what the commands are to execute from within a procedure to run unix commands on the database server and capture those results back to the procedure for parsing & manipulation.
    Thanks.

    Don't take this as the correct way to do it, but this is merely 'a' way to do it:
    have a db procedure thats executes a db function
    create or replace procedure csproc(p_cmd in varchar2)
    as
    x number;
    begin
    x:=csfunc(p_cmd);
    dbms_output.put_line('x is: '||x);
    end;
    /The function calls a piece of java to execute the os command and return the return code of the os command
    create or replace function csfunc( p_cmd  in varchar2) return number
    as language java
    name 'csclass.RunThis(java.lang.String[]) return integer';
    /Here is the java class to run the os command
    create or replace and compile java source
    named "csclass"
    as
    import java.io.*;
    import java.lang.*;
    public class csclass extends Object
    public static int RunThis(String[] args)
       Runtime rt = Runtime.getRuntime();
        int        rc = -1;
        try
           Process p = rt.exec(args[0]);
          int bufSize = 4096;
           BufferedInputStream bis =
           new BufferedInputStream(p.getInputStream(), bufSize);
           int len;
           byte buffer[] = new byte[bufSize];
           // Echo back what the program spit out
           while ((len = bis.read(buffer, 0, bufSize)) != -1)
              System.out.write(buffer, 0, len);
           rc = p.waitFor();
        catch (Exception e)
           e.printStackTrace();
           rc = -1;
        finally
           return rc;
    /and finally the os command - in this case its a very simple shell script
    #!/usr/bin/ksh
    echo "Hi" >> /app/oracle/workdir/cs.logwill have to grant privileges to my user 'CS' to run the various os commands
    exec dbms_java.grant_permission('CS','java.io.FilePermission','/app/oracle/workdir/cs.ksh','read,execute');
    exec dbms_java.grant_permission('CS','java.io.FilePermission','/app/oracle/workdir/cs.log','write');
    exec dbms_java.grant_permission('CS','SYS:java.lang.RuntimePermission','*','readFileDescriptor');
    exec dbms_java.grant_permission('CS','SYS:java.lang.RuntimePermission','*','writeFileDescriptor');and finally can run the procedure from within the db
    set serveroutput on
    exec dbms_java.set_output(1000000);
    exec csproc('/app/oracle/workdir/cs.ksh');
    x is: 0
    PL/SQL procedure successfully completed.to prove it works ok the logfile shows an entry:
    'Hi'

  • 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;
    /

  • How do I access BSD file tree from within Linux?

    I just installed PC-BSD 8.0 RC on an external USB HDD.  I went with the PC-BSD default partition layout, i.e. one primary partition for the entire PC-BSD slice, and 4 "partitions" within that slice, for /, swap, /usr and /var.
    In order to access the PC-BSD file tree from within Linux, I mount it as follows:
    mount -t ufs -o ufstype=ufs2,ro /dev/sdb1 /mnt/bsd
    But after executing this command I can only access the PC-BSD / , not /usr and /var , presumably because they reside on two BSD "partitions" (subslices) different from / .  Is there any way I can mount these (read-only) in Linux, too, or would I have to reinstall PC-BSD and opt for laying out the slice differently, i.e. specifying only / and swap in sdb1?
    Last edited by RobF (2010-02-13 11:55:39)

    Look at  /dev/sdb*  there should be more than just sdb1.  You would need to mount those to see which is which.  For ufs write support the default kernel needs to be recompiled with experimental enabled.

  • How to call a procedure from within another procedure?

    What's the syntax to call a procedure from within a procedure.
    I have a procedure z(user_id IN number, ....)
    then
    procedure a (user_id IN number, ....)
    procedure b (user_id IN number, ....)
    procedure c (user_id IN number, ....)
    I want to call procedure a, b, c from inside procedure z.
    How would I do that?

    Same way :
    SCOTT@db102 SQL> create or replace procedure a (p1 in varchar2) is
      2  begin
      3     dbms_output.put_line (p1);
      4* end;
    SCOTT@db102 SQL> /
    Procedure created.
    SCOTT@db102 SQL> create or replace procedure z (par1 in number) is
      2  begin
      3     if par1 != 0 then
      4             a ('This is proc a');
      5     end if;
      6* end;
    SCOTT@db102 SQL> /
    Procedure created.
    SCOTT@db102 SQL> set serveroutput on
    SCOTT@db102 SQL> exec z (1);
    This is proc a
    PL/SQL procedure successfully completed.
    SCOTT@db102 SQL>                                                    

  • How to write custom messages to Data Manager package log from within SSIS?

    Just wonder in BPC 7.0/7.5 MS how do you write custom messages to Data Manager package log from within SSIS?  I mean I want to log output of specific custom tasks (non-BPC) in SSIS control flow to the resultant BPC package log created when running SSIS package in Data Manager.  Can this be done in a Script Task or some other way?  Not much documentation out there on this.
    Thanks,
    Brian

    Hi Brian
    In order to achieve what you want, it can get tricky in your package, ultimately It would depend on the task, for example if you had an execute SQL task, you could use a RAISEERROR command in your SQL statement and BPC would return the error message that you specified.
    If you had other tasks, then it would be a bit more tricky, you would have to have custom messages based on event handlers.
    Please see below links for examples :
    [Custom messages for logging|http://msdn.microsoft.com/en-us/library/ms345174.aspx]
    [Custom Logging Using Event Handlers |http://consultingblogs.emc.com/jamiethomson/archive/2005/06/11/SSIS_3A00_-Custom-Logging-Using-Event-Handlers.aspx]
    Hope this helps
    Kind Regards
    Daniel

  • Using APEX_MAIL from within a procedure invoked from DBMS_JOB

    I have done a lot of googling and wasted a couple of days getting nowhere and would appreciate some help. But I do know that in order to use APEX_MAIL from within a DBMS_JOB that I should
    "In order to call the APEX_MAIL package from outside the context of an Application Express application, you must call apex_util.set_security_group_id as in the following example:
    for c1 in (
    select workspace_id
    from apex_applications
    where application_id = p_app_id )
    loop
    apex_util.set_security_group_id(p_security_group_id =>
    c1.workspace_id);
    end loop;
    I have created a procedure that includes the above (look towards the end)
    create or replace procedure VACANCIES_MAILOUT
    (p_application_nbr number,
    p_page_nbr number,
    p_sender varchar2)
    AS
    Purpose: Email all people registerd in MAILMAN [email protected]
    with details of any new vacancies that started listing today.
    Exception
    when no_data_found
    then null;
    when others then raise;
    l_body CLOB;
    l_body_html CLOB;
    l_vacancy_desc VARCHAR2(350);
    to_headline varchar2(200);
    to_org varchar2(100);
    l_vacancies_desc varchar2(2000);
    to_workspace_id number(22);
    CURSOR vacancies_data IS
    select DISTINCT v.headline to_headline,
    ou.org_name to_org
    from VACANCIES v,
    Org_UNITS ou
    where
    ou.org_numb = v.Org_Numb
    and v.public_email_sent_date is Null
    Order by ou.org_name, v.headline;
    BEGIN
    BEGIN
    FOR vacancies_rec in vacancies_data
    -- build a list of vacancies
    loop
    BEGIN
    l_vacancy_desc := '<br><b>' ||
    vacancies_rec.to_org || '<br>' ||
    vacancies_rec.to_headline || '</b><br>';
    -- l_vacancy_desc :=
    -- vacancies_rec.to_org || ' - ' ||
    -- vacancies_rec.to_headline ;
    l_vacancies_desc := l_vacancies_desc || l_vacancy_desc;
    END;
    END LOOP;
    END;
    l_body := 'To view the content of this message, please use an HTML enabled mail client.'||utl_tcp.crlf;
    l_body_html :=
    '<html>
    <head>
    <style type="text/css">
    body{font-family:  Verdana, Arial, sans-serif;
                                   font-size:11pt;
                                   margin:30px;
                                   background-color:white;}
    span.sig{font-style:italic;
    font-weight:bold;
    color:#811919;}
    </style>
    </head>
    <body>'||utl_tcp.crlf;
    l_body_html := l_body_html || l_vacancies_desc
    || '<p>-----------------------------------------------------------------------------------------------------------------</strong></p>'
    ||utl_tcp.crlf
    || '<p>The above new vacancies have been posted on the <strong>Jobs At Murdoch</strong> website.</p>'
    ||utl_tcp.crlf
    ||'<p>For futher information about these vacancies, please select the following link</p>'
    ||utl_tcp.crlf
    ||'<p> Jobs At Murdoch </p>'
    ||utl_tcp.crlf
    ||'<p></p>'
    ||utl_tcp.crlf;
    l_body_html := l_body_html
    ||' Regards
    '||utl_tcp.crlf
    ||' <span class="sig">Office of Human Resources</span>
    '||utl_tcp.crlf;
    for c1 in (
    select workspace_id
    from apex_applications
    where application_id = 1901)
    loop
    apex_util.set_security_group_id(p_security_group_id => c1.workspace_id);
    end loop;
    apex_mail.send(
    p_to => '[email protected]',
    p_from => '[email protected]',
    p_body => l_body,
    p_body_html => l_body_html,
    p_subj => 'Jobs At Murdoch - new vacancy(s) listed');
    update VACANCIES
    set public_email_sent_date = trunc(sysdate,'DDD')
    where public_email_sent_date is null;
    commit;
    END;
    but still get the error
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    ORACLE_HOME = /oracle
    System name: Linux
    Node name: node
    Release: 2.6.18-194.17.1.el5
    Version: #1 SMP Mon Sep 20 07:12:06 EDT 2010
    Machine: x86_64
    Instance name: instance1
    Redo thread mounted by this instance: 1
    Oracle process number: 25
    Unix process pid: 5092, image: (J000)
    *** 2011-07-12 09:45:03.637
    *** SESSION ID:(125.50849) 2011-07-12 09:45:03.637
    *** CLIENT ID:() 2011-07-12 09:45:03.637
    *** SERVICE NAME:(SYS$USERS) 2011-07-12 09:45:03.637
    *** MODULE NAME:() 2011-07-12 09:45:03.637
    *** ACTION NAME:() 2011-07-12 09:45:03.637
    ORA-12012: error on auto execute of job 19039
    ORA-20001: This procedure must be invoked from within an application session.
    ORA-06512: at "APEX_040000.WWV_FLOW_MAIL", line 290
    ORA-06512: at "APEX_040000.WWV_FLOW_MAIL", line 325
    ORA-06512: at "APEX_040000.WWV_FLOW_MAIL", line 367
    ORA-06512: at "HRSMENU_TEST.VACANCIES_MAILOUT", line 94
    ORA-06512: at line 1
    Can someone please tell me what what stupid thing I am doing wrong? The procedure worked when invokded from SQL Workshop but fails in a DBMS_JOB.
    much thanks Peter

    I think that might help...
    http://www.easyapex.com/index.php?p=502
    Thanks to EasyApex..
    LK

  • How to use dbms_Scheduler.Create_Job from within stored procedure?

    Hello,
    using 10g (10.1.0.2.0) on Windows 2000 I had problems to create scheduler jobs from within a stored procedure (see example below). What easily succeeds using anonymous blocks failed when calling from a stored procedure, due to ORA-27486. Only when I compile the procedure with invoker's rights the call to dbms_Job.Create_Job is successfull!? From my knowledge there is no difference between invoker's and definer's rights, if I compile and call with the same user, is there?
    Does anyone know the reason for this behaviour or is it simply a bug?
    Have a nice day.
    Björn Hachmann
    Hamburg / Germany
    -- Example start.
    create table t
    a number(1),
    b date default sysdate
    create or replace procedure sched1
    is
    begin
    dbms_scheduler.create_job(
    job_name => 'TEST_JOB1',
    job_type => 'PLSQL_BLOCK',
    job_action => 'BEGIN insert into t values (1); END;',
    repeat_interval => 'freq=secondly',
    enabled => TRUE
    commit;
    end;
    create or replace procedure sched2
    authid current_user
    is
    begin
    dbms_scheduler.create_job(
    job_name => 'TEST_JOB2',
    job_type => 'PLSQL_BLOCK',
    job_action => 'BEGIN insert into t values (2); END;',
    repeat_interval => 'freq=secondly',
    enabled => TRUE
    commit;
    end;
    exec sched1; -- This call fails with ORA-27486.
    exec sched2; -- This call succeeds!
    /* Cleanup.
    exec dbms_scheduler.drop_job('TEST_JOB1', true);
    exec dbms_scheduler.drop_job('TEST_JOB2', true);
    drop table t;
    */

    Your example code ran without problems for me on 10.1.0.3.0 so it probably is a bug.

  • Help!How can I find the name of a calling procedure from within a procedure/function?

    Is there anyway to find out the name of calling procedure(database) from within a database stored procedure/function? This is required for creating an auditing module.
    Thanks,
    Abraham
    ===========
    email:[email protected]

    You can use this query to get the procedure names that are calling your procedure.
    SELECT name FROM all_Dependencies
    WHERE upper(referenced_name) = 'YOUR_PROC_NAME'
    In your procedure, you can get these values into a cursor and then use them one by one.
    Hope this would help.
    Faheem

  • Finding hard and soft open file limits from within jvm in linux

    Hi All,
    I have a problem where I need to find out the hard and soft open file limits for the process in linux from within a java program. When I execute ulimit from the terminal it gives separate values for hard and soft open file limits.
    From shell if I run the command then the output is given below:
    $ ulimit -n
    1024
    $ ulimit -Hn
    4096
    The java program is given below:
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.Reader;
    import java.io.StringWriter;
    import java.io.Writer;
    public class LinuxInteractor {
    public static int executeCommand(String command, boolean waitForResponse, OutputHandler handler) {
    int shellExitStatus = -1;
    ProcessBuilder pb = new ProcessBuilder("bash", "-c", command);
    pb.redirectErrorStream(true);
    try {
    Process shell = pb.start();
    if (waitForResponse) {
    // To capture output from the shell
    InputStream shellIn = shell.getInputStream();
    // Wait for the shell to finish and get the return code
    shellExitStatus = shell.waitFor();
    convertStreamToStr(shellIn, handler);
    shellIn.close();
    catch (IOException e) {
    System.out
    .println("Error occured while executing Linux command. Error Description: "
    + e.getMessage());
    catch (InterruptedException e) {
    System.out
    .println("Error occured while executing Linux command. Error Description: "
    + e.getMessage());
    return shellExitStatus;
    public static String convertStreamToStr(InputStream is, OutputHandler handler) throws IOException {
    if (is != null) {
    Writer writer = new StringWriter();
    char[] buffer = new char[1024];
    try {
    Reader reader = new BufferedReader(new InputStreamReader(is,
    "UTF-8"));
    int n;
    while ((n = reader.read(buffer)) != -1) {
    String output = new String(buffer, 0, n);
    writer.write(buffer, 0, n);
    if(handler != null)
    handler.execute(output);
    } finally {
    is.close();
    return writer.toString();
    } else {
    return "";
    public abstract static class OutputHandler {
    public abstract void execute(String str);
    public static void main(String[] args) {
    OutputHandler handler = new OutputHandler() {
    @Override
    public void execute(String str) {
    System.out.println(str);
    System.out.print("ulimit -n : ");
    LinuxInteractor.executeCommand("ulimit -n", true, handler);
    System.out.print("ulimit -Hn : ");
    LinuxInteractor.executeCommand("ulimit -Hn", true, handler);
    If I run this program the output is given below:
    $ java LinuxInteractor
    ulimit -n : 4096
    ulimit -Hn : 4096
    I have used ubuntu 12.04, Groovy Version: 1.8.4 JVM: 1.6.0_29 for this execution.
    Please help me in understanding this behavior and how do I get a correct result from withing the java program.

    Moderator Action:
    As mentioned in one of the earlier responses:
    @OP this is not a Java question. I suggest you take it elsewhere, i.e. to a Unix or Linux forum.You posted this to a Java programming forum.
    It is not a Java programming inquiry.
    This off-topic thread is locked.
    Additionally, you have answered your own question.
    Don't bother posting it to one of the OS forums. It will get deleted as a duplicate cross-post.

  • How to output various file types from a stored procedure

    Good morning, I would like to output to spreadsheet files like microsoft Excel, Lotus 123 or to a comma delimited text file from stored procedures. We run Oracle 8i and this report is accessed from an intranet site using stored procedures and the pl/sql web toolkit. The results would be more usefull in a spreadsheet format than web page(s). Can anyone give me a hint as to which process to follow to get the output. Thanks very much, Francois

    Probably best to try the PL/SQL SQL forum:
    http://forums.oracle.com/forums/forum.jsp?id=478021
    Some quick and easy pointers:
    * Take a look at the COM feature available from PL/SQL in 8i:
    http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/win.920/a95499/toc.htm
    * Just write the file out as comma delimited using UTL_FILE and give it a file name of .csv. Quick scan on google gives this example:
    http://www.flash.net/~swilliam/PLunloadSQL.txt
    Mike.

  • Compressing file size from within a portfolio?

    I've got 16 files within a PDF portfolio ranging from 80MB to 227Mb and I'm trying to compress them, the portfolio size is 1.41GB.  When I view the file size in Bridge as I compress each file I don't see any change in the individual file sizes nor in the Portfolio size.  Are the original files being compressed or are they stored seperately within the portfolio file?  And any idea why the portfolio size nor the original file sizes are changing after PDF optimization?

    Thanks, Leo.
    To my mind, this looks about right : http://www.adobe.com/products/livecycle/pdfgenerator/
    Do you know whether this will be suitable for integration into .net code?
    Can it cover our needs (Concatenation, Compression, Bookmark-Editing)?

  • Is there a way of printing the file name from within the Preview application?

    If I'm printing a file within Apple's Preview application, I sometimes want to be able to print the file name at the edge of the document. Does anyone know of way of doing this?

    Thanks for replying, that goes some way to answering the question, but I'm also looking to see how much space each app and its associated documents are using, i.e. Pages comes in at 112Mb for the app alone, but I'd like to know how much space is being used by the documents as well.
    Once again thanks,
    SG

  • Calling a procedure from within a procedure

    Hi Guys,
    I have created a package to base a form on. The package contains some procedures, one of which is an Update procedure which can be seen below. I have a procedure in another package that I am trying to call. Basically the second procedure is called to implement a constraint. However, I am unsure as to what I should pass into this procedure, as a package/procedure for basing a form on is different to what I have come across before.
    CREATE OR REPLACE package staff_dml IS
    TYPE staff_rec IS RECORD (staff_id NUMBER(7),
              first_name VARCHAR2(20),
              last_name VARCHAR2(20),
              tel_no NUMBER(11),
              manager_id NUMBER(7),
              position VARCHAR2(20),
    rest_id NUMBER(7),
              grade VARCHAR2(1),
              wage NUMBER(7,2));
    TYPE staff_cursor IS REF CURSOR RETURN staff_rec;
    TYPE staff_table IS TABLE OF staff_rec INDEX BY BINARY_INTEGER;
    PROCEDURE staff_update (data IN OUT staff_table);
    PROCEDURE staff_find (data IN OUT staff_cursor);
    PROCEDURE staff_lock (data IN OUT staff_table);
    END;
    CREATE OR REPLACE PACKAGE BODY staff_dml IS
    PROCEDURE staff_lock (data IN OUT staff_table)
    IS
    temp NUMBER;
    BEGIN
    SELECT staff_id into temp
    FROM staff
    WHERE staff_id = data(1).staff_id
    FOR UPDATE;
    END staff_lock;
    PROCEDURE staff_find (data IN OUT staff_cursor)
    IS
    BEGIN
    OPEN data FOR SELECT staff_id, first_name, last_name, tel_no, manager_id, position, rest_id, grade, wage
    FROM staff;
    END staff_find;
    PROCEDURE staff_update
    (data IN OUT staff_table)
    IS
    BEGIN
    IF data(1).wage != data(1).wage THEN
    special_pkg.staff_chk(data(1).wage,data(1).grade);
    END IF;
    IF data(1).grade != data(1).grade THEN
    special_pkg.staff_chk(data(1).wage,data(1).grade);
    END IF;
    UPDATE staff
    SET first_name = data(1).first_name, last_name = data(1).last_name, tel_no = data(1).tel_no, manager_id = data(1).manager_id,
    position = data(1).position, rest_id = data(1).rest_id, grade = data(1).grade, wage = data(1).wage
    WHERE staff_id = data(1).staff_id;
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE(SQLCODE||' '||SQLERRM);
    END staff_update;
    END;
    The area I an concerned about is:
    IF data(1).wage != data(1).wage THEN
    special_pkg.staff_chk(data(1).wage,data(1).grade);
    END IF;
    IF data(1).grade != data(1).grade THEN
    special_pkg.staff_chk(data(1).wage,data(1).grade);
    END IF;
    I do not know what I should be passing into the special_pkg.staff_chk procedure which accepts two number inputs. I want to use this package to compare the new inputs on this to the existing ones (this is carried out by the procedure. I have tried using :new. but this is not accepted. If I leave in the EXCEPTION then i get no errors from the form, but it will not save any changes I make on the database. If I remove the EXCEPTION then I get an error from the form - FRM-40735 UPDATE-PROCEDURE trigger raised unhandled exception ORA-04098. I am pretty sure this is because I am not supplying the correct variables to the called procedure,
    The called procedure is below (tested and working):
    PROCEDURE staff_chk
    (p_wage IN NUMBER,
    p_grade IN NUMBER)
    IS
    BEGIN
    IF p_wage BETWEEN 0 AND 7.00 AND p_grade != 'C' THEN
    RAISE_APPLICATION_ERROR(-20002, 'The Incorrect grade has been applied to this employee');
    ELSIF p_wage BETWEEN 7.01 AND 10 AND p_grade != 'B' THEN
    RAISE_APPLICATION_ERROR(-20003, 'The Incorrect grade has been applied to this employee');
    ELSIF p_wage BETWEEN 10.01 AND 20 AND p_grade != 'A' THEN
    RAISE_APPLICATION_ERROR(-20004, 'The Incorrect grade has been applied to this employee');
    END IF;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    DBMS_OUTPUT.PUT_LINE('Staff member does not exist');
    END staff_chk;
    END;
    Any help would be greatly appreciated.
    Thanks,
    Anton

    Since this appears to be an Oracle Forms related question, you may want to pose it over in the Oracle Forms forum.
    Forms
    The folks over there are a lot more likely to be able to solve your problem.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

Maybe you are looking for

  • How do I attach multiple files from the pages app to my email

    I'm trying to attach multiple documents from the "Pages" app to my email.  I'm using an ipad.  It is only letting me attach one at a time and send each document as individual emails.  I would like to be able to send one email with all 4 documents at

  • Any chance of recovering data from a possibly fried drive?

    I have probably fried this external drive. I don't hear the drive head spinning at all when I plug it in anymore. It does not show up under /dev nor does it show up with the cat /proc/partitions command. Is there any way to use testdisk/photorec etc

  • Upload file in to file system using Apex

    Hi... I have tried UTL_FILE to upload file in Directory. But First i have to upload file in Table in BLOB datatype and then copy it to file system using BFILE. I have to store files in file system as per requirements. I want to upload file directly t

  • Excel documents on my iPad

    Hello, How can I modify excel documents on my Ipad in Numbers? And how can I change the direction of the text in the documents on my ipad 2?

  • How to reinstall LR5 if Application Manager still shows "up to date" although I've uninstalled it?

    I work with Mac OS.. I've installed LR5 using the Adobe Application Manager and, a few weeks later, the program crashed and I cound't solve its problem. I decided to uninstalled it bu found no way to do this using the App. Manager, so I deleted it fr