Questions of procedure body loop

I have a procedure that generates a parameter as Excel worksheet, depending on the criteria selected by the user. To make it easier for the tests I select a range of 3 leases of this form. Each location can have several entries according to the number of invoices. I'm putting it altogether and a blank line between each group of lease, but I'm having a problem with how to loop.
Here is the code:


CODE

PROCEDURE Excel_ReportData (v_cl_no varchar2,
v_pr_no varchar2,
date of v_ls_date,
v_beg_no varchar2,
v_end_no varchar2) is


cursor c1 (v_cl_no varchar2,
v_pr_no varchar2,
date of v_ls_date,
v_beg_no varchar2,
v_end_no varchar2) is

Select tran_type, lease_no, tran_no, tran_date, dscr, ar_col, ap_col,.
cl_no, pr_no, lease_date, ls_no
lease_transactions a, lease_master b
where b.ls_no = a.lease_no
and b.cl_no = decode (null, b.cl_no, v_cl_no, v_cl_no)
and b.pr_no = decode (null, b.pr_no, v_pr_no, v_pr_no)
and b.lease_date = decode (null, b.lease_date, v_ls_date, v_ls_date)
and nvl(b.ls_no,0) between nvl(v_beg_no,-100) and nvl(v_end_no,9999999999)
order by 2, 4;

cursor c2 (v_cl_no varchar2,
v_pr_no varchar2,
date of v_ls_date,
v_beg_no varchar2,
v_end_no varchar2) is

Select lease_no, nvl (sum (ar_col), 0) ar_sum, nvl (sum (ap_col), 0) ap_sum
lease_transactions a, lease_master b
where b.ls_no = a.lease_no
and b.cl_no = decode (null, b.cl_no, v_cl_no, v_cl_no)
and b.pr_no = decode (null, b.pr_no, v_pr_no, v_pr_no)
and b.lease_date = decode (null, b.lease_date, v_ls_date, v_ls_date)
and nvl(b.ls_no,0) between nvl(v_beg_no,-100) and nvl(v_end_no,9999999999)
Lease_no group
order by 1;

CR1 c1% rowtype;
CR2 c2% rowtype;

number of v_i;
number of v_no;
v_Name varchar2 (20): = "Lease_Trans";

v_tran_type varchar2 (50);
v_lease_no varchar2 (20);
v_tran_no varchar2 (100);
date of v_tran_date;
v_dscr varchar2 (500);
number of v_amount;
number of v_ar_col;
number of v_ap_col;
date of v_lease_date;


BEGIN

Oleexcel.SheetName: = "Sheet1".
OleExcel.OpenSheet;
OLE2.release_obj (oleexcel.worksheet);



OleExcel.LineWeight: = 0;

--
-Insert the new worksheet to the front
--

oleexcel. SheetName: = v_name;
Oleexcel.NewSheet;
Excel_PageSetup (2, 5);

--
-Build header
--

V_I: = 1;
AC. Counter: = 0;
OleExcel.Set_Cell_ValFullFmt (v_i, ac.nxt, "T. S. DUDLEY LAND COMPANY, Inc.', null, 'Arial', 14, 'Bold', null, OleExcel.cellWhite, false, OleExcel.Left);
Blank_Cells (v_i, ac.counter + 4, 52);

V_I: = v_i + 1;
AC. Counter: = 0;
OleExcel.Set_Cell_ValFullFmt (v_i, ac.nxt, 'REPORT of TRANSACTIONS of LEASE", null,"Arial", 10,"Bold", null, OleExcel.cellWhite, false, OleExcel.Left);
Blank_Cells (v_i, ac.counter + 4, 52);

V_I: = v_i + 1;
AC. Counter: = 0;
OleExcel.Set_Cell_ValFullFmt (v_i, ac.nxt, 'Date', null, 'Arial', 10, 'Normal', null, OleExcel.cellWhite, false, OleExcel.Left);
OleExcel.Set_Cell_ValFullFmt (v_i, ac.nxt, to_char (sysdate, ' DD/MM/YYYY'), ' MM/DD/YYYY","Arial", 10, 'Normal', null, OleExcel.cellWhite, false, OleExcel.Left);
Blank_Cells (v_i, ac.counter + 1, 52);

V_I: = v_i + 1;
Blank_Cells (v_i, 1, 52);

--
-To make the topics
--

V_I: = v_i + 1;
OleExcel.LineWeight: = 4;
AC. Counter: = 0;

oleexcel. Set_Cell_ValFullFmt (v_i, ac.nxt, 'No lease', null, "Arial", 10, "Bold", true, null, OleExcel.cellGray,);
oleexcel. Set_Cell_ValFullFmt (v_i, ac.nxt, "Type of Transaction", null, "Arial", 10, "Bold", true, null, OleExcel.cellGray),
oleexcel. Set_Cell_ValFullFmt (v_i, ac.nxt, "Transaction No.", null, "Arial", 10, 'Fat', null, OleExcel.cellGray, true);
oleexcel. Set_Cell_ValFullFmt (v_i, ac.nxt, "Date of the Transaction", null, "Arial", 10, "Bold", true, null, OleExcel.cellGray,);
oleexcel. Set_Cell_ValFullFmt (v_i, ac.nxt, "Description of the Transaction", null, "Arial", 10, "Bold", true, null, OleExcel.cellGray,);
oleexcel. Set_Cell_ValFullFmt (v_i, ac.nxt, "amount of the Transaction", null, "Arial", 10, "Bold", true, null, OleExcel.cellGray,);
oleexcel. Set_Cell_ValFullFmt (v_i, ac.nxt, "Accounts receivable", null, "Arial", 10, "Bold", true, null, OleExcel.cellGray,);
oleexcel. Set_Cell_ValFullFmt (v_i, ac.nxt, "Accounts payable", null, "Arial", 10, "Bold", true, null, OleExcel.cellGray,);

V_I: = 5;
AC. Counter: = 0;
oleexcel. Set_Cell_Property (v_i, ac.nxt, oleexcel.cellWidth, ' 12');
oleexcel. Set_Cell_Property (v_i, ac.nxt, oleexcel.cellWidth, ' 16');
oleexcel. Set_Cell_Property (v_i, ac.nxt, oleexcel.cellWidth, ' 22');
oleexcel. Set_Cell_Property (v_i, ac.nxt, oleexcel.cellWidth, ' 12');
oleexcel. Set_Cell_Property (v_i, ac.nxt, oleexcel.cellWidth, ' 40');
oleexcel. Set_Cell_Property (v_i, ac.nxt, oleexcel.cellWidth, ' 14');
oleexcel. Set_Cell_Property (v_i, ac.nxt, oleexcel.cellWidth, ' 12');
oleexcel. Set_Cell_Property (v_i, ac.nxt, oleexcel.cellWidth, ' 12');

OleExcel.LineWeight: = 2;
OleExcel.Border_Cells (OleExcel.CellAddress (v_i, 1) |) ':' || OleExcel.CellAddress (v_i, ac.counter));
oleexcel. Set_Cell_Property (v_i, ac.counter, oleexcel.cellHeight, ' 38.25' ");

V_I: = 5;

Open c1 (v_cl_no, v_pr_no, v_ls_date, v_beg_no, v_end_no);
Open c2 (v_cl_no, v_pr_no, v_ls_date, v_beg_no, v_end_no);

loop

Fetch c1 into cr1;
When exit c1% notfound;
extract the c2 in cr2;
When the exit c2% notfound;

V_I: = v_i + 1;
AC. Counter: = 0;

--
-Data output
--

oleexcel. Set_Cell_ValFullFmt (v_i, ac.nxt, cr1.lease_no, null, "Arial", 10, 'Normal', null, OleExcel.cellWhite, false, OleExcel.Left);
oleexcel. Set_Cell_ValFullFmt (v_i, ac.nxt, cr1.tran_type, null, 'Arial', 9, 'Normal', null, OleExcel.cellWhite, false, OleExcel.Left);
oleexcel. Set_Cell_ValFullFmt (v_i, ac.nxt, cr1.tran_no, null, 'Arial', 9, 'Normal', null, OleExcel.cellWhite, false, OleExcel.Left);
oleexcel. Set_Cell_ValFullFmt (v_i, ac.nxt, to_char (cr1.tran_date, ' MM/DD/YYYY ' '), ' DD/MM/YYYY","Arial", 9, 'Normal', null, OleExcel.cellWhite, false, OleExcel.Center);
oleexcel. Set_Cell_ValFullFmt (v_i, ac.nxt, cr1.dscr, null, 'Arial', 9, 'Normal', null, OleExcel.cellWhite, false, OleExcel.Left);
oleexcel. Set_Cell_ValFullFmt (v_i, ac.nxt, to_char (cr1.amount), "$#, # 0.00", "Arial", 9, 'Normal', null, OleExcel.cellWhite, false, OleExcel.Right ');
oleexcel. Set_Cell_ValFullFmt (v_i, ac.nxt, to_char (cr1.ar_col), "$#, # 0.00", "Arial", 9, 'Normal', null, OleExcel.cellWhite, false, OleExcel.Right ');
oleexcel. Set_Cell_ValFullFmt (v_i, ac.nxt, to_char (cr1.ap_col), "$#, # 0.00", "Arial", 9, 'Normal', null, OleExcel.cellWhite, false, OleExcel.Right ');

oleexcel. Set_Cell_Property (v_i, ac.counter, oleexcel.cellHeight, ' 15');

OleExcel.LineWeight: = 2;
OleExcel.Border_Cells (OleExcel.CellAddress (v_i, 1) |) ':' || OleExcel.CellAddress (v_i, ac.counter));

Blank_Cells (v_i, ac.counter + 1, 52);

V_I: = v_i + 1;
AC. Counter: = 0;

--
-Data output
--

oleexcel. Set_Cell_ValFullFmt (v_i, ac.nxt, "Total", "Arial", 9, 'Normal', null, null, OleExcel.cellWhite, true, OleExcel.Left);
oleexcel. Set_Cell_ValFullFmt (v_i, ac.nxt, null, null, "Arial", 9, 'Normal', null, OleExcel.cellWhite, false);
oleexcel. Set_Cell_ValFullFmt (v_i, ac.nxt, null, null, "Arial", 9, 'Normal', null, OleExcel.cellWhite, false);
oleexcel. Set_Cell_ValFullFmt (v_i, ac.nxt, null, null, "Arial", 9, 'Normal', null, OleExcel.cellWhite, false);
oleexcel. Set_Cell_ValFullFmt (v_i, ac.nxt, null, null, "Arial", 9, 'Normal', null, OleExcel.cellWhite, false);
oleexcel. Set_Cell_ValFullFmt (v_i, ac.nxt, null, null, "Arial", 9, 'Normal', null, OleExcel.cellWhite, false);
oleexcel. Set_Cell_ValFullFmt (v_i, ac.nxt, to_char (cr2.ar_sum), "$#, # 0.00", "Arial", 9, 'Normal', null, OleExcel.cellWhite, false, OleExcel.Right ');
oleexcel. Set_Cell_ValFullFmt (v_i, ac.nxt, to_char (cr2.ap_sum), "$#, # 0.00", "Arial", 9, 'Normal', null, OleExcel.cellWhite, false, OleExcel.Right ');

oleexcel. Set_Cell_Property (v_i, ac.counter, oleexcel.cellHeight, ' 15');

OleExcel.LineWeight: = 2;
OleExcel.Border_Cells (OleExcel.CellAddress (v_i, 1) |) ':' || OleExcel.CellAddress (v_i, ac.counter));

Blank_Cells (v_i, ac.counter + 1, 52);

end loop;

Close c1;
Close c2;

END;


I tried several different things, but this is the Basic code, which is to put the totals at the end and not showing a lease when it should return 3 leases with multiple lines with the total line after each group.

I only did Oracle development for a few months so I hope it's an easy question.
JLW, thanks

You will need to build a break manually each time the value of the c1-query-changes lease_no and then get the sum explicitly for this lease_no, somethink like:

DECLARE
  nLastLeaseNo NUMBER:=NULL;
BEGIN
  OPEN c1;
  LOOP
    FETCH c1 INTO rec1;
    -- Check if lease_no changed
    IF nLastLeaseNo IS NULL THEN
      -- set last-value for start
      nLastLeaseNo:=rec1.LEASE_NO;
    ELSIF nLastLeaseNo!=rec1.LEASE_NO OR c1%NOTFOUND THEN
      -- change of lease_no or last record
      -- fetch summary data
      OPEN c2(rec1.LEASE_NO);
      FETCH c2 INTO rec2;
      CLOSE c2;
      -- create summary line
      ...
      -- create blank line
      ...
      -- remember last-value for next break
      nLastLeaseNo:=rec1.LEASE_NO;
    END IF;
    -- exit after last record
    EXIT WHEN c1%NOTFOUND;
    -- Loop data out to excel
    ...

  END LOOP;
  CLOSE c1;
END;

Adjust the slider 2 to take the lease_no as input value and restrict the query to this lease_no.

I hope this helps.

Tags: Oracle Development

Similar Questions

  • Work Dbma_scheduler execution of procedure which loops through all the customer drawings in the rear rollers database transaction in case of exception

    Hello

    Need your contributions on the approach to implement a work using dbms_scheduler.

    We have about 2000 drawings. Each schema has a package with 2 procedures.

    The requirement is to create a single job in SYS that loop over each schema and run the procedures specific to a time (once a day) and send a notification by e-mail on success or failure.

    Working script:

    BEGIN

    dbms_scheduler.create_job (job_name = > 'LOAD_EACH_SCHEMA_AUDIT_DATA',)

    job_type = > 'PLSQL_BLOCK ',.

    job_action = > ' BEGIN sys.p_loadaudit;

    END;',

    start_date = > systimestamp,

    repeat_interval = > ' FREQ = MINUTELY; RANGE = 1',

    number_of_arguments = > 0,

    enabled = > true,

    Comments = > "Use repeat interval is every five minutes");

    END;

    /

    Note: to test the end I put him repeat interval to carefully.

    Use of procedure must be running:

    Procedure sys.p_loadaudit:

    CREATE OR REPLACE

    PROCEDURE p_loadaudit

    AS

    v_count NUMBER: = 0;

    lv_error_message VARCHAR2 (4000);

    vstmt VARCHAR2 (4000);

    BEGIN

    I'm IN

    (SELECT username FROM dba_users WHERE username LIKE '% ABCFIRM')

    )

    LOOP

    vstmt: = "begin" | i.UserName | '. pkg_audit_info.p_load_coa; end;';

    EXECUTE immediate vstmt;

    vstmt: = "begin" | i.UserName | '. pkg_audit_info.p_load_am; end;';

    EXECUTE immediate vstmt;

    END LOOP;

    EXCEPTION

    WHILE OTHERS THEN

    lv_error_message: = ' error in procedure p_loadaudit: ' | SQLCODE. "- ERROR -" | SUBSTR)

    SQLERRM, 1, 300). '*' || dbms_utility.format_error_backtrace;

    raise_application_error(-20002,lv_error_message);

    END p_loadaudit;

    /

    Example of a scheme: SCHEMA_01

    create or replace

    PACKAGE pkg_audit_info

    AS

    CursorType type

    IS

    REF

    CURSOR;

    PROCEDURE p_load_COA;

    PROCEDURE p_load_AM;

    END pkg_audit_info;

    /

    create or replace

    Pkg_audit_info body PACKAGE

    AS

    PROCEDURE p_load_COA

    AS

    BEGIN

    INSERT INTO TABLE1();

    EXCEPTION

    WHILE OTHERS THEN

    lv_error_message: = ' error in procedure pkg_audit_info.p_load_COA: ' | SQLCODE

    || "- ERROR -" | SUBSTR (SQLERRM, 1, 300). '*' || dbms_utility.format_error_backtrace;

    RAISE_application_error(-20002,lv_error_message);

    END p_load_COA;

    PROCEDURE p_load_AM

    AS

    BEGIN

    INSERT INTO TABLE2();

    EXCEPTION

    WHILE OTHERS THEN

    lv_error_message: = ' error in procedure pkg_audit_info.p_load_AM: ' | SQLCODE.

    "- ERROR -" | SUBSTR (SQLERRM, 1, 300). '*' || dbms_utility.format_error_backtrace;

    RAISE_application_error(-20002,lv_error_message);

    END p_load_AM;

    END pkg_audit_info;

    /

    Table1 and table1 exist in schema_01.

    All 2000 patterns have same package.procedures.

    For security reasons, I removed the actual code.

    I was able to complete the task successfully. However, when a scheme procedure (SCHEMA_01.pkg_audit_info.p_load_COA) throws an exception, the job fails, and any transaction is rolled back.

    Is it possible to loop through each schema and run the corresponding procedures. Even if the exception occurs, it must restore only for this scheme and continue other patterns in the loop?

    Please let me know if there is a better way to do this. Is the way I'm handling exceptions in the work or the correct procedure?

    Thank you

    Hello

    RAISE_APPLICATION_ERROR will cause the program to exit to the appellant, even if you put it inside a block in the loop, so the statement RAISE or RAISE_APPLICATION_ERROR must be placed in your procedures 'pkg_audit_info.p_load_AM' and 'pkg_audit_info.p_load_coa '. In this way, you can use a block inside the loop and the error in the log.

    I'm IN

    (SELECT username FROM dba_users WHERE username LIKE '% ABCFIRM')

    )

    LOOP

    BEGIN

    vstmt: = "begin" | i.UserName | '. pkg_audit_info.p_load_coa; end;';

    EXECUTE immediate vstmt;

    vstmt: = "begin" | i.UserName | '. pkg_audit_info.p_load_am; end;';

    EXECUTE immediate vstmt;

    EXCEPTION

    WHILE OTHERS THEN

    --> Set the error in a table of otherwise custom event log you won't know what happened for this scheme: don't forget the user name

    END;

    END LOOP;

  • Two questions in table "While loop"

    Hello

    I have two questions about creating tables in while loops. I'm using LabView 8.5.1.

    In its simplest form, my current while loop (delay set to 0, 2 s) has 3 variables that have been changed by moving a slider. They are each sent to a line in a block of 'Building the table' (data type is DBL 1 d) - this table is then written to a spreadsheet file, such as the three values are written to a new line (one value per column) whenever the while loop runs.

    Question 1

    How can I add a column 'Time' in this worksheet? In other words, get at the present time the loop works since then, from 0 seconds in the spreadsheet, via the table block building.

    I can think of how to do this with a loop For, but given that the While loop runs through an unknown number of iterations, I can't figure out how to get the counter to work.

    Question 2

    How can I text column headings on the worksheet?

    Thanks for the help and if you need anything anyone stating, please let me know

    To answer question 1:

    There is a function of 'Elapsed Time' you can put as the first colum of the data.

    This then reformatted your spreadsheet as
    Time Data1 Data2 Data3

    Time Data1 Data2 Data3

    Time Data1 Data2 Data3

    etc...

    To answer question 2:

    Build a table of positions, then write this table in the file only once, outside the loop.

    Your table with the data and time will write inside the loop.

  • Question of architecture / chained loops

    Hey guys,.

    So, I got a quick question on the loops of producer/consumer.

    I have a DAQ loop which I am trying to control - i.e. when to acquire data or when to go to the "idle" mode.

    At some point I want to acquire data at all times, while at another time, I want to stop and go to the "idle" mode.

    I was wondering what is the best way to to do.

    My outer loop should he send the Canadian signal and period of time later (1 or 2 seconds) will send a signal to stop, again, another signal of departure.

    1. use a notifier that sends a Notification of Cluster (option + command)--> containing some settings I need to acquire-the command 'acquire '.

    2. enter this notifier with Notification of Signal waiting

    --> This to enter the State to acquire

    3 return the same identical notification making a loop.

    OR

    1. use a notifier that sends a Notification of Cluster (option + command)--> containing some settings I need to acquire-the command 'acquire '.

    2. observe notifications with a function of State notifying get. When the declaring State changes to acquire, it will always acquire and where another notification is sent (stop) then the State will change.

    The other seems like the obvious solution, but I wonder if there are any reservations-c.-d. race conditions general/warnings warning do not use the service to get notification...

    Am not too familiar with some of the strange scenarios and me have already been screwed by Notifications jump some orders before - it was boring hard haha

    Or actually... If you have any other suggestions on how to make this architecture works, I'm all ears.


  • Newbie question: How do I loop to stop when the weather changes?

    I'm using a 'chain of Date/Time Format vi"with a time format string % H: %m, I want time to stop a loop when the minute is changed. How should I do tjis?

    See you soon,.

    Sam

    Hi Sam,

    instead of shrek juggling with chains and locals (property node.value is the type of local!), you must use a whole number and register shift...

  • Simple question: timed period while loops

    Hello

    I have a timed loop, and if the user presses a button "repeat" loop runs until 'repeat' is set to false. I want the loop to iterate over a given period, including user input. Inside the loop, a square wave pulse is created based on the parameters provided by the user, then displayed on a waveform graph.

    However, when I change some of the initial settings of the square wave, for example from tension, the waveform graph is updated instantly. I want the waveform graph only be updated based on the period provided by the user, all say a second. I tried to set the period of entry into different amounts of 10000 a.0001, but always updated at the same time waveform graph.

    I'm not sure what I'm missing, but I'm sure it's something trivial. My VI is attached. Any help will be appreciated.

    I don't understand what your problem is.

    If I run your VI (and hit the repeat button firstly, otherwise VI blink tracks then stops) and make changes to tensions, duration or delay, it will take a little time or a lot of time according to the what is the length of the loop, and where I do the modification to controls during the delay of the loop.

    (With a period of 5000 milliseconds, a change can take up to 5 seconds to show in the event where you make the change right after the beginning of the loop.)  «(Or it may take a fraction of a second if you make the change just before the loop iteration ends).»

    Maybe you can give us a configuration of the parameters, we should enter each controls (even better puts these settings yourself, do the default values, and then save the VI before posting) as well as specific guidance on what we should do to recreate all that is your problem.

  • Question about layers and loops!

    Hey guys,.

    I am a newbie and I hope I can explain this scenario properly.

    Basically, I create a banner in Flash 8 Pro, graphic designs previous.     It consists of a backdrop, a 4 frame logo and the text I want to sweep in on the left hand side on 20% of the banner.

    Now! ... is there a way to create a layer to have this text appear on and stop at a desired position, while the main logo covers the 4 frames continuously?   (I had a go, but everything seems to work, in other words, the same steam - no separate command)

    Hope that is more clear as mud?

    All the best,

    CAL

    Hi Cal,

    Or you can create a movieclip (F8) and place your 4 images of logo in this movieclip.

    Then in Scene1 you can place the movieclip on layer logo and on a separate layer have your text flying in animation.

    One thing to remember to do this way is to make sure that your film has enough frames to account for multiples of four, other wise your logo will look like its onece jump the playhead in loop at the beginning.

    Hope that makes sense

  • question simple idoc - a loop in a result set.

    Just got back from holidays and watching a code, but my brain has decided to give up something that should be so simple...

    Can anyone help unlock my head? :)

    Whats is the best way of...
    Browse meta-data and write pair name & value, by using the DOC_INFO service without having to manually write all metafields?

    Here is a small example of what I'm doing but cannot figure out how to get the names of current fields; Maybe use rsFieldByIndex, but it seems silly and I can not find any function to return...

    EXEC DOC_INFO
    LOOPWHILE GETVAL (SEARCHRESULTS)
    WRITE TO SEARCHRESULTS.NAME
    WRITE SEARCH RESULTS. VALUE
    RSNEXT
    ENDLOOP

    what Miss me?
    Thank you
    J /.

    Hi John,.

    It's funny he is actually a very good example of what you're trying to do in the doc IDOC Schema section.

    Here it is:

    <$getViewValuesResultSet("Country_View", "",="" "")$="">
    <$loop schemadata$="">
    <$count =="" 0,="" num="rsNumFields(" schemadata")$"="">
    <$loopwhile count="">< num$="">
    <$fieldName=rsFieldByIndex("SchemaData", count)$="">
    <$fieldName$>=<$getValue("SchemaData", fieldname)$="">
    <$count =="" count="" +="" 1$="">
    <$endloop$>
    <$endloop$>

    With a doc info it would look more like fine.

    <$dID="12345"$>
    <$executeService("DOC_INFO")$>
    <$loop doc_info$="">
    <$count =="" 0,="" num="rsNumFields(" doc_info")$"="">
    <$loopwhile count="">< num$="">
    <$fieldName=rsFieldByIndex("DOC_INFO", count)$="">
    <$fieldValue$>=<$getValue("DOC_INFO", fieldname)$="">
    <$count =="" count="" +="" 1$="">
    Field name:<$fieldName$>
    Field value:<$fieldValue$>
    <$endloop$>
    <$endloop$>

    Thanks... hope the holiday was good!
    David

  • Package body error

    Hello people.

    Oracle Database 10 g Express Edition Release 10.2.0.1.0 - product

    PL/SQL Release 10.2.0.1.0 - Production

    Hope you are all well.  I am creating a package as a procedure body, but I get the following error:

    • Error (37.7): PL/SQL: statement ignored
    • Error (38,15): PLS-00201: identifier ' C1. Email_address' must be declared

    I'm fairly inexperienced, so the resolution may be simple, but I'm still confused as to what to do.  Here is my code:

    create or replace 
    PACKAGE BODY            "CHECK_VISA_DATE" 
    AS
    PROCEDURE "VISA_EXPIRY"
    IS
        l_msg_body varchar2(32000) := null;
        l_count number := 0;
    BEGIN
    FOR c1 IN
        (SELECT E.EMPLOYEE_ID,
        E.CLOCK_NUMBER,
        E.LAST_NAME,
        E.FIRST_NAME,
        E.EMAIL_ADDRESS,
        E.VISA_EXPIRY
        FROM EMPLOYEE E,
        EMPLOYEE_CONTRACT EC
        WHERE E.EMPLOYEE_ID = EC.EMPLOYEE_ID
        AND EC.ACTUAL_END IS NULL
        AND EC.FUTURE_CONTRACT = 1
        AND EC.SUB_TASK = 1
        AND E.VISA_EXPIRY < SYSDATE + 60)
    LOOP
      IF l_count = 0
        THEN
            L_MSG_BODY :=
            'As of today, your visa is due to 
            expire in 60 days '||chr(10)||
            CHR(10)||
            ' Visa Expiration: '|| c1.VISA_EXPIRY;
      END IF;
        l_count := l_count + 1;
    END LOOP;
    
    
    IF L_MSG_BODY IS NOT NULL
      THEN
          HTMLDB_MAIL.SEND(
          P_TO => c1.EMAIL_ADDRESS,
          P_BODY => L_MSG_BODY,
          P_SUBJ => 'Visa Expiration '||
          c1.VISA_EXPIRY);
    END IF;
    END "VISA_EXPIRY";
    END "CHECK_VISA_DATE";
    

    Hello

    AquaNX4 wrote:

    ...

    Output is an email, so there really isn't any type of insert statements, or additional information to give...

    If there is no relevant information in AMPEMP or EMP_CONTRACT tables, then you don't need to question the in your procedure.

    • Error (24,112): PLS-00302: component 'VISA_EXPIRY' must be declared

    There is no column called

    VISA_EXPIRis the cursor.  Did you mean to say

    E VISA_EXPIR?

  • Synchronize with looping background

    Hello

    I'm doing 2d side view car animation.i have a background loop composition. Sometimes my car has to overcome obstacles on the road.and I cannot do a real synchronization between the compositions of the loop road and objects on the road.i cannot put objetcs open-ended know.how looping you can provide sync them together?

    the second question is have background looping and looping the wheels if I want to stop the animation I use the case expression, but when I want to start that maintain the rolling of composition, but it starts in the first image. How can I fix?

    Try this. Add a null value to the model and name it something like Null 1 speed. Add this expression to the position property of the null value:

    y = value [1];

    v = comp ("BackG.ai Comp 1").layer("BackG.ai").effect ("Offset") ("Center To Shift") .velocityAtTime (.1);

    s = (time - inPoint) * v 2;

    x = value [0] + s;

    [x [0], y]

    This is what makes the expression. Line a grab the current value of Y for the value null. Line 2 picks up speed of the offset in the model of the background. More on that later. Line 3 begins to count the time to the point of in the layer draw and then the time is multiplied by the speed of the offset in pixels per second. Because it is a shift of speed and not a speed of position, multiply this number by 2... Line 4 adds the value of "s" of line 3 to the value of position X of the null value. Finally, you declare the table for position that uses the calculated value for X based on the speed of the offset and the current value of y.

    Now you parent one of the obstacle of the layers to null, set the point in to the barrier layer and the null value at the point in the script where you want the barrier to appear and then down the timeline until it empties into the truck. Then divide you the layer (Ctrl/Cmnd + shift + d) and remove the first folio of parenting. You can then animate position and rotation to simulate the collision.

    Duplicate the value null and join the procedure with your other obstacles.

    One more comment on your computer. I noticed that the speed of your wheels did not match the speed of the background. It is also very easy to fix because you know the speed in pixels per second and if you multiply the diameter of the wheel by PI, you can calculate the circumference of the wheel. Simple math makes the wheels turn at the right speed. The expression in images keys and loopOut() courses can be replaced by this expression:

    v = comp ("BackG.ai Comp 1").layer("BackG.ai").effect ("Offset") ("Center To Shift") .velocityAtTime (.1);

    s = duration * v [0];

    c = Math.PI * width;

    s * c

    You should be able to figure thins out. Here is your comp with changes made to the layer of barrel. Take advantage of...

  • Appeal procedure in another procedure using the Out parameter slider - lesson

    Hello

    I am new to Oracle development so first I wonder if it is a good place with a simple way of the of on how to create stored procedures?  I'm looking for the most part at this stage for a quick read.

    Second, currently have hacked and slashed my way into getting one built.  It has 3 parameters and an output parameter sys_refcursor.  This procedure works.

    I want to have another created procedure that will call the above procedure and loop through each row in the setting out and write to a file.  Can someone point me to an example of this by any chance?

    Thanks for the help.

    Hello

    e28d78d3-c6c6-4BCE-b14f-0f6bf26fa17c wrote:

    Thanks for the reply.

    Here's what I have, but I'm getting many errors.  When I seem to fix one that I get a new one. Kind of like what it show me all questions vs one question at a time.  I never know if I create another error of my attempts at fixing what, in my view, could be the problem.  In any case, something to get used to.

    When you do any type of programming, take baby steps.  Write less code as possible, test what you wrote ' worm and, if it contains errors, correct them and test again.

    The PL/SQL compiler tries to show all errors, but often it is impossible to say what is a separate mistake, and which is a consequence of a previous error.  For example, the DECLARE statements in your code are perfectly valid PL/SQL statements, but they are the mistakes in the sense that they are not what you think, and you may not use them.  PL/SQL does not know that (I don't really know that, either, but I'm willing to guess in this case).  The works of compiler on the explanation that you really wanted to say SAID, until what it becomes obvious, maybe several lines later, that something makes no sense, but at this time, there is no way he could say that the undesirable DECLARE was the cause.

    So here is where I am stuck currently.  What I want should first, run the stored procedure and I think I do as you suggest.  Which returns data in the output parameter, which is of type sys_refcursor.  I think I would need to loop through each element that cursor and output to the file using the dbms_output you reference and like I did below.  This should be it.  Sounds simple enough, but it's where some of the basics for me.

    For example, by creating the procedure some examples have the name of the procedure and then some "AS", "IS".  When use the beginning and the end and when not I need?

    There is no difference betwwen

    CREATE PROCEDURE... AS and

    CREATE PROCEDURE... Use IS the one you prefer.  You must always one or the other, however.

    PL/SQL is written in blocks.  The basic structure of a block is

    DECLARE - optional, sometimes involved

    ...

    BEGIN

    ...

    -Optional EXCEPTION; forget it for now

    ...

    END;

    Almost all of the PL/SQL code is part of a block.  In fact, you could argue that anything not in a block isn't really PL/SQL.  (For example, CREATE PROCEDURE is really an SQL, PL/SQL not, it indicates the SQL that some PL/SQL compiler is coming.)

    You should always BEGIN and END keywords in a PL/SQL block; None is never optional.

    I think I'm doing the for loop correctly but I get an error on the portion of loop-end.  It is a part of these simple things that become I think that.

    That's what I have:

    CREATE OR REPLACE PROCEDURE APPS.boact_report_3

    AS

    DECLARE v_cur SYS_REFCURSOR;

    DECLARE v_file_out UTL_FILE.file_type;

    BEGIN

    I said earlier, DECLARED may be implied.  It's one of those places if there is nothing after CREATE PROCEDURE... IS and before STARTING, it is supposed to be a statement.

    You can have as many statements (0, 1, 2 or more) that you want in this section of the statement.  The semicolon at the end of each of them is all the separation you need each other; you don't need any keyword as STATED.

    Open the v_cur for

    bo_report (p_sv_id, p_start_date, p_end_date, out v_cur);  -stored procedure that girls v_cur witch is a sys_refcursor parameter.  It works

    END;

    BEGIN

    Don't forget, how to call a procedure is

    bo_report (x, y, z);

    not

    bo_report (x, y, z OUT);

    The key words are only necessary (and only used) in the declaration of a procedure, not in his appeal.  When you create a procedure, you decide if each argument is going to be an argument IN, an OUT argument, or IN OUT argument, and you tell the compiler that you decide.  When you call a procedure, you have no choice; each argument is IN, OUT or IN OUT has already been decided, and suffice to say compiling what are the variables (or expressions) that you use to play these predetermined roles.

    Dbms_output.put_line ('Date: ');

    v_file_out: =.

    UTL_FILE.fopen (' / public/scripts/smorau02 ', 'w_act.csv', 'W');

    FOR x IN v_cur

    LOOP

    () UTL_FILE.put_line

    v_file_out,

    x.cl_num | ','

    || x.wa_id | ','

    || x.Description | ','

    || x.a_date | ','

    || x.a_by | ','

    || x.v_Name | ','

    || x.SITE_NAME | ','

    || x.stage | ','

    || x.in_queue);

    END LOOP;

    UTL_FILE.fclose (v_file_out);

    END;

    Thanks again for the help.

    You have not to send the code to bo_report, so I can't run the procedure.  I do not notice any obvious mistakes immediately superior.

  • Forms v4.5 and FFI question

    All,

    We have a legacy in Forms 4.5 application. It is going to be retired soon, but I need urgent change in its current form.

    We have a C program that performs certain file operations. I have the
    the source code and can change and compile it in a dll. The problem
    Is that Forms 4.5 seems not to find it and guard pick up the old man
    one. I put the dll in the same directory as the fmx files, but no joy.
    Is there a way I can tell where he seeks forms and even how I can
    specifically, force it to use and load a specific file?
    Where ora_ffi.find_library and ora_ffi.load_library alike?

    This is the code of the PL/SQL procedure body
    FFI_E2SBASE PACKAGE BODY IS

    /*

    Define the different handles

    */

    lh_ffie2sb ora_ffi.libHandleType;

    fh_e2sbase ora_ffi.funcHandleType;

    /*

    Define internal versions of the functions

    *

    * The interface function, notice how the C pointers correspond to variables IN OUT

    */

    FUNCTION i_e2sbase (funcHandle IN ora_ffi.funcHandleType,

    e2sbase IN OUT VARCHAR2,

    BuffLen IN THE PLS_INTEGER)

    RETURN PLS_INTEGER;

    -interface for the function internal interface C

    PRAGMA INTERFACE (C, i_e2sbase, 11265);

    -The body of the Externalised function

    FUNCTION e2sbase (e2sbase IN OUT VARCHAR2, BuffLen IN OUT PLS_INTEGER) RETURN PLS_INTEGER IS

    /*

    * Declare the buffer supplemented up to the maximum possible length of the string

    * It's a var In Out e2sbase may already have some

    * content

    *

    * This RPAD guarantees that the VARCHAR string occupies contiguous memory

    */

    e2sbase_l VARCHAR2 (600): =.

    RPAD (SUBSTR (NVL (e2sbase,' '), 1,600), 600, CHR (0));

    /*

    * Buffer memory for the Int without filling required here.

    */

    BuffLen_l PLS_INTEGER: = BuffLen;

    RC PLS_INTEGER;

    BEGIN

    /*

    Dial the internal version of the function with the local buffers

    */

    RC: = i_e2sbase (fh_e2sbase, e2sbase_l, BuffLen_l);

    /*

    * Reset the real variables with the contents of the buffer

    */

    e2sbase: = substr(e2sbase_l,1,BuffLen_l);

    BuffLen: = BuffLen_l;

    RETURN (rc);

    END;

    /*

    * Package Body Block, handles loading the DLL into memory and recording of the

    * Functions

    */

    BEGIN

    BEGIN

    /*

    * Try to find the already loaded DLLS

    */

    lh_ffie2sb: = ora_ffi.find_library('e2sbase.dll');

    EXCEPTION WHEN ora_ffi. FFI_ERROR THEN

    /*

    * Not found Ok lets load

    * The argument null to LOAD the library is the location of the DLL, so if

    * the DLL is not in

    * the working DIR or not in the path somewhere we might want to

    * put something here.

    */

    lh_ffie2sb: = ora_ffi.load_library(,'e2sbase.dll');

    END;

    /*

    * Now sign up for the e2sbase

    */

    fh_e2sbase: = ora_ffi.register_function (lh_ffie2sb,

    "e2sbase", ora_ffi. C_STD);

    ora_ffi.register_parameter (fh_e2sbase, ORA_FFI. C_CHAR_PTR);

    ora_ffi.register_parameter (fh_e2sbase, ORA_FFI. C_INT_PTR);

    ora_ffi.register_return (fh_e2sbase, ORA_FFI. C_INT);

    EXCEPTION

    /*

    * Error handler FFI generic to unwind the stack TOOL_ERR

    */

    WHILE OTHERS THEN

    for iCounter in 1.tool_err.nerrors

    LOOP

    message (tool_err.message);

    tool_err.pop;

    END loop;

    END FFI_E2SBASE;

    To force forms to load the DLL to a specified directory, use the following syntax:

    BEGIN
    BEGIN
    -Try to find the already loaded DLLS
    lh_ffie2sb: = ora_ffi.find_library ("e2sbase.dll");
    EXCEPTION
    WHEN ora_ffi.ffi_error
    THEN
    -Okay, not found can load
    -The argument null to LOAD the library is the location of the DLL, so if
    -the DLL is not in
    -the working DIR or not in the path somewhere we might want to
    -put something here.

    lh_ffie2sb: = ora_ffi.load_library ('C:\MyDirectory\', 'e2sbase.dll');
    END;

    Better yet, create an environment variable and use l_path: = win_api_environment ('MY_ENV_VAR', FALSE);

  • changing the values of loop iteration

    Happy new year everyone!

    I have a question about changing the loop iteration number set to a loop for. I made a simple example of what I had imagined in my mind, but I knew that it wouldn't work, however, it shows what I want to accomplish. I would use a switch or something to control the loop, so you can start running to essentially infinity, which is the constant from 1000000 and then go on a number of controlled if the loop ends in fact and the code can move. Each iteration is a second.

    Thanks for any ideas you may have

    A While loop is a loop For which has no fixed number of iterations (if you allow me, he 's going to try to go to infinity).  It has a Stop indicator that stops the loop if True is wired for it.  Note that if True is wired to the stop indicator when the loop begins, the loop will always be executed (once).  In this sense, it is slightly different from a loop For 0 cable to the input of N (which does nothing).

    So some time, use a loop to do this.

    Bob Schor

    PS - you should know...

    PPS: I just looked at your VI.  I'm sure you realize that the way to data flow rules you need to set the Boolean and order digital before start the programme - once it starts and gets into the while loop, changes you make outside the loop will have no influence on the code inside the loop.

    Have you taken the LabVIEW tutorials?  If so, and if not, go look again, attention to the program flow, loops, etc..

  • While loops inside while loops, how to stop?

    Hey, I'm confused with a simpler question to multiple while loops. My goal: stop or pylone2, just jump out of the small loop and stay in the big one. and if I click on stop 3. the entire program would cease... How can I do this? The following script does not at all... Thanks in advance!

     

    Yes you are completely right Mike... now, I solved the problem with another structure of the event and the Boolean variable local... Thank you very much!

  • How to end Vi in a For loop

    Hello. I enclose my Vi. I have a question about stopping a loop For I have 2 loops for the case "Test underway". I have a termial conditional that will stop my Vi but only after you have completed all the iterations of the loop For I have need of this Vi to stop immediately, when you press the stop button. I realize that it will take probably still finish an iteration, however, at the present time it waits until all iterations are performed, before coming to rest. I'm doing it with the same front button that stops the while loop. I tried a local variable, but to change a mechanical action and I prefer not to do, if this is possible. There was a lot of posts related to this topic here on the forum but I couldn't find the one suited to my needs. Thank you for your time.

    Your While loop waiting loops to stop, so you can use local variables of your stop button to stop the for loops right now.

    See you soon,.

    Jimmy

Maybe you are looking for