Link the 'LOOP' undeclared variable.

Hello

I am very new to Pl/SQL. My job needs me to migrate MySQL to Oracle database (which I did successfully), but the procedures described in the MySQL has no could be migrated to Oracle, have so create them manually.

When the procedure created, make me these errors

Error (4.1): PLS-00103: encountered the symbol "DECLARE" when expecting one of the following values: type of the subtype of the function pragma < an ID > < a double quote delimited identifier > removal of current cursor exists before the symbol 'start' is substituted for 'DECLARE' continue.

Error (5.1): PLS-00103: encountered the symbol "DECLARE" when expecting one of the following values: type of subtype of the function pragma < an ID > < a between double quote delimited identifiers > removal of current cursor are prerequisite
CREATE OR REPLACE PROCEDURE PROCEDURE1 AS 
BEGIN
Declare v_date date;
Declare v_particulars varchar(50);
Declare v_quantity float default 0;
Declare v_item integer default 0;
Declare v_vendor integer default 0;
Declare v_flag integer default 1;
Declare v_supplier_id integer default null;
Declare v_unit integer default 0;
Declare v_srno integer default 0;
Declare op_date date;
declare op_bal float default 0;
Declare temp_v_from_date date;
Declare temp_v_to_date date;
Declare done integer default 0;
Declare cur1 cursor for  (select  sibs.opening_balance_date,'Opening Balance',sibs.item_id,
sum(sibs.opening_balance_qty), '1'from store_item_batch_stock sibs  where sibs.opening_balance_date is not null
and sibs.department_id = v_depart  and  sibs.item_id = v_item_id group by sibs.item_id);
Declare cur2 cursor for  (select sgm.grn_date, concat('Receipt',' - (',sgm.grn_no,')'), sgt.item_id,
sum(NVL((case d.formula when 1   then ((sgt.received_qty + sgt.free_qty) * sgt.mdq_value) / d.conversion_factor1
else (sgt.received_qty + sgt.free_qty) end),0)), '2',sgm.supplier_id,sgm.unit_id from store_grn_m sgm,
store_grn_t sgt, mas_store_item c, mas_store_item_conversion d
where sgm.grn_date between v_from_date and v_to_date and  sgm.department_id = v_depart
and   sgt.item_id = c.item_id  and   c.item_conversion_id = d.item_conversion_id  and   sgt.grn_master_id = sgm.grn_master_id
and   sgt.item_id = v_item_id group by sgm.grn_master_id         );
Declare cur3 cursor for (select sim.issue_date,concat('Issue',concat(' -(',concat(sim.issue_no,')'))), sit.item_issued,
sum(NVL(sit.qty_issued,0)), '3'  from store_issue_m sim, store_issue_t sit
where sim.issue_date between v_from_date and v_to_date and   sim.department_id = v_depart
and   sit.issue_m_id = sim.id  and   sim.issue_type = 'i' and   sit.item_issued = v_item_id
and   sit.issued = 'y' group by sim.id         );
Declare cur4 cursor for (select sgrm.return_date, 'Vendor Return', sgrt.item_id,
sum(NVL(sgrt.return_qty,0)), '3' from store_grn_return_m sgrm,store_grn_return_t sgrt
where sgrm.return_date between v_from_date and v_to_date      and   sgrm.department_id = v_depart
and   sgrt.grn_return_id = sgrm.grn_return_id  and   sgrt.item_id = v_item_id  group by  sgrm.grn_return_id         );
Declare cur5 cursor for (select sadm.adjustment_date, 'Adjustment',sadt.item_id,
sum(NVL(sadt.adjust_qty,0)), '2'                  from store_adjustment_m  sadm,
store_adjustment_t  sadt where sadm.adjustment_date between v_from_date and v_to_date
and   sadm.department_id = v_depart  and   sadt.adjust_id = sadm.id  and   sadt.item_id = v_item_id
and   sadt.adjust_qty != 0 group by sadm.id                  );
Declare cur6 cursor for (select sim.issue_date,'Receipt (Internal)', sit.item_issued,
sum(NVL(sit.qty_issued,0)), '2' from store_issue_m sim, store_issue_t sit
where sim.issue_date between v_from_date and v_to_date      and   sim.to_store = v_depart
and   sit.issue_m_id = sim.id   and   sim.issue_type = 'i'   and   sit.item_issued = v_item_id
and   sit.issued = 'y' group by sim.id         );
declare cur7 cursor for (select siam.adjustment_date, 'Adjustment',siat.item_id,
sum(NVL(siat.adjusted_qty,0)), '2'                  from store_item_adjustment_m  siam,
store_item_adjustment_t  siat where siam.adjustment_date between v_from_date and v_to_date
and   siam.adjustment_login_dept = v_depart  and   siat.item_adjustment_m_id = siam.item_adjustment_id
and   siat.item_id = v_item_id and   siat.adjusted_qty != 0 group by siam.item_adjustment_id
);
Declare oldcur1 cursor for  (select sgm.grn_date, 'Receipt', sgt.item_id,
sum(NVL((case when d.formula =1  then ((sgt.received_qty + sgt.free_qty) * sgt.mdq_value) / d.conversion_factor1
else (sgt.received_qty + sgt.free_qty) end),0)), '2'                  from store_grn_m sgm,
store_grn_t sgt, mas_store_item c, mas_store_item_conversion d
where sgm.grn_date between '2009-03-31' and (v_from_date -1)
and   sgm.department_id = v_depart  and   sgt.item_id = c.item_id  and   c.item_conversion_id = d.item_conversion_id
and   sgt.grn_master_id = sgm.grn_master_id  and   sgt.item_id = v_item_id  group by sgm.grn_master_id  );
Declare oldcur2 cursor for (select sim.issue_date,'Issue', sit.item_issued,
sum(NVL(sit.qty_issued,0)), '3' from store_issue_m sim, store_issue_t sit
where sim.issue_date between '2009-03-31' and (v_from_date -1)
and   sim.department_id = v_depart  and   sit.issue_m_id = sim.id  and   sim.issue_type = 'i'
and   sit.item_issued = v_item_id   and   sit.issued = 'y' group by sim.id         );
Declare oldcur3 cursor for (select sgrm.return_date, 'Return', sgrt.item_id, sum(NVL(sgrt.return_qty,0)), '2'
from store_grn_return_m sgrm, store_grn_return_t sgrt
where sgrm.return_date between '2009-03-31' and (v_from_date -1)
and   sgrm.department_id = v_depart   and   sgrt.grn_return_id = sgrm.grn_return_id   and   sgrt.item_id = v_item_id group by sgrm.grn_return_id );
Declare oldcur4 cursor for (select sadm.adjustment_date, 'Adjustment',sadt.item_id,
sum(NVL(sadt.adjust_qty,0)), '2'  from store_adjustment_m  sadm, store_adjustment_t  sadt
where sadm.adjustment_date between '2009-03-31' and (v_from_date -1)  and   sadm.department_id = v_depart
and   sadt.adjust_id = sadm.id   and   sadt.item_id = v_item_id  and   sadt.adjust_qty != 0 group by sadm.id );
Declare oldcur5 cursor for (select sim.issue_date,'RCPT', sit.item_issued, sum(NVL(sit.qty_issued,0)), '3' from store_issue_m sim,
store_issue_t sit where sim.issue_date between '2009-03-31' and (v_from_date -1)  and   sim.to_store = v_depart
and   sit.issue_m_id = sim.id   and   sit.item_issued = v_item_id   and   sit.issued = 'y' group by sim.id );
declare oldcur7 cursor for (select siam.adjustment_date, 'Adjustment',siat.item_id,
sum(NVL(siat.adjusted_qty,0)), '2'                  from store_item_adjustment_m  siam,
store_item_adjustment_t  siat where siam.adjustment_date between '2009-03-31' and (v_from_date -1)
and   siam.adjustment_login_dept = v_depart  and   siat.item_adjustment_m_id = siam.item_adjustment_id  and   siat.item_id = v_item_id
and   siat.adjusted_qty != 0 group by siam.item_adjustment_id
);
Declare closingStockUpdateCursor cursor for(select sno,date,qty,flag from ledger where dept_id = v_depart  and item_id = v_item_id
and flag!=0 order by date  );
Declare continue handler for not found set done =1;
delete from ledger where item_id = v_item_id and dept_id = v_depart;
Open cur1;
item_loop:loop
Fetch cur1 into v_date, v_particulars, v_item, v_quantity, v_flag;
If done =1 then
Leave item_loop;
End if;
if not (v_date > v_from_date) then
set op_bal = v_quantity;
set op_date = v_date;
End if;
End loop item_loop;
Close cur1;
set  done = 0;
Open oldcur1;
item_loop:loop
Fetch oldcur1 into v_date, v_particulars, v_item, v_quantity, v_flag;
If done =1 then
Leave item_loop;
End if;
set op_bal = op_bal + v_quantity;
End loop item_loop;
Close oldcur1;
set  done = 0;
Open oldcur2;
item_loop:loop
Fetch oldcur2 into v_date, v_particulars, v_item, v_quantity, v_flag;
If done =1 then
Leave item_loop;
End if;
set op_bal = op_bal - v_quantity;
End loop item_loop;
Close oldcur2;
set  done = 0;
Open oldcur3;
item_loop:loop
Fetch oldcur3 into v_date, v_particulars, v_item, v_quantity, v_flag;
If done =1 then   Leave item_loop;
End if;   set op_bal = op_bal + v_quantity;
End loop item_loop;
Close oldcur3;
set  done = 0;
Open oldcur4;
item_loop:loop
Fetch oldcur4 into v_date, v_particulars, v_item, v_quantity, v_flag;
If done =1 then
Leave item_loop;
End if;
if op_date != v_date then
set op_bal = op_bal + v_quantity;
End if;
End loop item_loop;
Close oldcur4;
set  done = 0;
Open oldcur5;
item_loop:loop
Fetch oldcur5 into v_date, v_particulars, v_item, v_quantity, v_flag;
If done =1 then   Leave item_loop;
End if;
set op_bal = op_bal + v_quantity;
End loop item_loop;
Close oldcur5;
set  done = 0;
Open oldcur7;
item_loop:loop
Fetch oldcur7 into v_date, v_particulars, v_item, v_quantity, v_flag;
If done =1 then   Leave item_loop;
End if;
set op_bal = op_bal + v_quantity;
End loop item_loop;
Close oldcur7;
set  done = 0;
insert into ledger(date, particulars,qty,item_id,dept_id,flag,closing_stock)   values(v_from_date,'Opening Balance', op_bal, v_item_id,v_depart,'0',op_bal);
Open cur2;
item_loop:loop
Fetch cur2 into v_date, v_particulars, v_item, v_quantity, v_flag, v_supplier_id, v_unit;
If done =1 then
Leave item_loop;
End if;
insert into ledger(date, particulars,qty,item_id,flag,dept_id,vendor_id,closing_stock,unit_id)   values(v_date,v_particulars, v_quantity, v_item,v_flag,v_depart,v_supplier_id,0,v_unit);
End loop item_loop;
Close cur2;
set  done = 0;
Open cur3;
item_loop:loop
Fetch cur3 into v_date, v_particulars, v_item, v_quantity, v_flag;
If done =1 then
Leave item_loop;
End if;
insert into ledger(date, particulars,qty,item_id,flag,dept_id,closing_stock)   values(v_date,v_particulars,v_quantity, v_item,v_flag,v_depart,0);
End loop item_loop;
Close cur3;
set  done = 0;
Open cur4;
item_loop:loop
Fetch cur4 into v_date, v_particulars, v_item, v_quantity, v_flag;
If done =1 then
Leave item_loop;
End if;
insert into ledger(date, particulars,qty,item_id,flag,dept_id,closing_stock)   values(v_date,v_particulars,v_quantity, v_item,v_flag,v_depart,0);
End loop item_loop;
Close cur4;
set  done = 0;
Open cur5;
 item_loop:loop
 Fetch cur5 into v_date, v_particulars, v_item, v_quantity, v_flag;
 If done =1 then   Leave item_loop;
 End if;
 insert into ledger(date, particulars,qty,item_id,flag,dept_id,closing_stock)   values(v_date,v_particulars, v_quantity, v_item,v_flag,v_depart,0);
 End loop item_loop;
 Close cur5;
 set  done = 0;
 Open cur6;
 item_loop:loop
 Fetch cur6 into v_date, v_particulars, v_item, v_quantity, v_flag;
 If done =1 then
 Leave item_loop;
 End if;
 insert into ledger(date, particulars,qty,item_id,flag,dept_id,closing_stock)   values(v_date,v_particulars, v_quantity, v_item,v_flag,v_depart,0);
 End loop item_loop;
 Close cur6;
 set  done = 0;
 Open cur7;
 item_loop:loop
 Fetch cur7 into v_date, v_particulars, v_item, v_quantity, v_flag;
 If done =1 then
 Leave item_loop;
 End if;
 insert into ledger(date, particulars,qty,item_id,flag,dept_id,closing_stock)   values(v_date,v_particulars, v_quantity, v_item,v_flag,v_depart,0);
 End loop item_loop;
 Close cur7;
 set  done = 0;
 Open closingStockUpdateCursor;
 item_loop:loop
 Fetch closingStockUpdateCursor into v_srno,v_date, v_quantity, v_flag;
 If done =1 then
 Leave item_loop;
 End if;
 if v_flag = 2 then
 set op_bal = op_bal + v_quantity;
 else
 set op_bal = op_bal - v_quantity;
 end if;
 update ledger set closing_stock = op_bal where sno = v_srno;
 End loop item_loop;
 Close closingStockUpdateCursor;
 set  done = 0;
 END
  NULL;
END PROCEDURE1;
/
Please help where I am doing wrong

Another comment.

If the two products are identical in functionality, there is nothing much to differentiate one from the other. And this is important because the differences between the products are what motivates the buyer who is the best decision.

There are differences major between Oracle and mySQL. Some basic and fundamental differences. And that is what makes a 'better' than the other - product and led the decision on whether to use Oracle or mySQL.

Oracle made a poor mySQL. He did very well the thing of Oracle. So it makes no sense to take a design and the code that works for mySQL, the Pinard on Oracle and think that the differences in this Oracle now allows to make this creation and of labour and 'performing '.

Everything but. As Oracle mimics poor mySQL, the end result of this will be a system that performs worse than what he did on mySQL.

To make use of what makes Oracle 'better' than mySQL, requires the application to be rethought and code refactored.

IMO, that you / your company are, is doomed to failure. You will have to pay more money for a more sophisticated and very capable product RDBMS - which fails to reach its potential, you want to pretend to be mySQL, and to do this, better than mySQL. It's an epic fail.

Tags: Database

Similar Questions

  • Put the loop of variables in a single table with formatting (PHP)

    I have the following loop;

    <? PHP

    $i = 1;

    While ($i < = $num_rows)

    {

    $tempquantity = "extra". $i.' quantity ';

    $tempcomments = "extra". $i."comments";

    $tempname = "extra". $i.' name ';

    $tempprice = "extra". $i."price";

    $$tempquantity = $_POST ['extra'. $i. "quantity"];

    $$tempcomments = $_POST ['extra'. $i. "Comments"];

    $$tempname = $_POST ['extra'. $i. "name"];

    $$tempprice = $_POST ['extra'. $i. 'price'];

    Print "Extra name: $$tempname;

    Print "< br / > ';

    Print "Extra price:". "." $$tempprice;

    Print "< br / > ';

    Print "quantity:". "." $$tempquantity;

    Print "< br / > ';

    Print "reviews:". "." $$tempcomments;

    Print "< br / > < br / > ';

    $i++;

    }

    ? >

    Which, since there are 3 rows, outputs the following:

    Extra-Nom: dfvgfddf

    Extra price: 4

    Quantity required: 67

    Customer reviews: gtfh


    Extra-Nom: wewew

    Extra price: 34

    Required quantity: 45

    Customer feedback: thtrt


    Extra name: ewewe

    Extra price: 43

    Required quantity: 12

    Customer feedback: gdfgg

    I want to be able to do is to show the output above in a PHP email body variable which, according to me, this means that the loop variables must be in a single array variable as coding in a body of email variable is not allowed. How can I put a loop of variables like that in a single variable, and how to keep the < br / > tags and names before variables ("name Extra:' etc."), so it seems that it should in the PHP email body?

    Thanks in advance

    I also need to set the variables generated by the loop in a single database field

    Why?  Looks like a mistake to me.

    Anyway, why not change it.



    The name of the tenant: $rentername

    on this subject.



    " The tenant's name: $rentername.

    $i = 1;

    While ($i<>

    {

    $tempquantity = "extra". $i.' quantity ';

    $tempcomments = "extra". $i."comments";

    $tempname = "extra". $i.' name ';

    $tempprice = "extra". $i."price";

    $$tempquantity = $_POST ['extra'. $i. "quantity"];

    $$tempcomments = $_POST ['extra'. $i. "Comments"];

    $$tempname = $_POST ['extra'. $i. "name"];

    $$tempprice = $_POST ['extra'. $i. 'price'];

    $body. =<>

    Additional name: $$tempname

    Extra charge: $$tempprice

    Required amount: $$tempquantity

    Customer reviews: $$tempcomments

    EOT;

    $i++;

    }

    and then remove the loop where it occurs earlier.

  • ORA-00904 PLS-00364: loop index variable

    Hi all

    create the table xxc_cust_id (cust_id number);

    insert into xxc_cust_id values (1)

    create table xxc_child (id number, part varchar2 (20), amount number);

    insert into xxc_child values (1, "Replaced processor", 1500)

    insert into xxc_child values (1, 'Replaced mouse', 200)

    insert into xxc_child values (' 6, ' mouse replaced ', 200)

    create table xxc_parent (ID, cust_id varchar2 (10));

    insert into xxc_parent values (1,1)

    insert into xxc_parent values (6.1)

    Select * from xxc_parent

    ID CUST_ID

    --------- ----------

    1 1

    6 1

    Select * from xxc_child

    AMOUNT OF PART ID

    -------- -------------------- ----------

    1 processor replaced 1500

    1 mouse replaced 200

    6 mouse replaced 200

    Select * from xxc_cust_id

    CUST_ID

    --------

    1

    I need

    CUST_ID PLATE

    --------                ----------

    1                     1900

    to insert data into the table xxc_details

    CREATE OR REPLACE PROCEDURE XXC_SUM_DETAILS

    IS

    CURSOR c_1

    IS

    SELECT Cust_id

    OF xxc_cust_id

    ORDER BY cust_id.

    CURSOR c1

    IS

    SELECT a.cust_id, SUM (sum) total_sum

    Xxc_parent a, xxc_child b

    WHERE a.id = b.id

    AND cust_id = c_cust_id.cust_id

    GROUP BY a.cust_id;

    BEGIN

    FOR c_cust_id IN c_1

    LOOP

    dbms_output.put_line ('Enter');

    C_rec IN C1

    LOOP

    BEGIN

    INSERT INTO xxc_details (part_id, total_amount)

    VALUES (c_rec.cust_id, c_rec.total_sum);

    COMMIT;

    END;

    END LOOP;

    END LOOP;

    END;

    LINE/COL ERROR

    -------- -----------------------------------------------------------------

    10/9 PL/SQL: statement ignored

    12/42 PL/SQL: ORA-00904: "C_CUST_ID." "" Cust_id ": invalid identifier

    21/13 PL/SQL: statement ignored

    22/41 PLS-00364: 'C_REC' use the loop index variable is not valid

    22/47 PL/SQL: ORA-00984: column not allowed here

    In this case you cannot include the sequence directly in the GROUP BY in the query part, that you can group on sequences or the aggregated.

    He must ignore the sequence to a higher level, the group so that it is assigned to each row that will be inserted in the sub-sub-group by query to...

    INSERT INTO xxc_details (details_id, cust_id, total_amount, CONTRACT_NUMBER)

    Select DETAILS_ID_SEQ. NEXTVAL

    cust_id

    total_sum

    quantity

    from (select a.cust_id,

    Total_sum SUM (b.amount),

    d.amount

    Xxc_parent a.,

    b xxc_child,

    xxc_cust_id c,

    xxc_sum_acc d

    where a.id = b.id

    and c.cust_id = a.cust_id

    and c.cust_id = d.cust_id

    AND contract_type = 'AML.

    and not exists (select 1

    of e xxc_details

    where c.cust_id = e.cust_id

    )

    GROUP BY a.cust_id, d.amount

    );

  • LIMITATION OF THE LOOP

    Hi again...

    I´d would like to know if any of you know why the following code returns this error:
    ORA-01426: digital overflow.

    It seems that the LOOP FOR variable, which in this case is represented by doesn´t I hold so much data that a variable NUMBER. Given how much the variable wait internal?
    DECLARE
      NUM1 NUMBER := 59171108702;
      NUM2 NUMBER := 59171108702;
    BEGIN
      
      FOR I IN NUM1 .. NUM2 LOOP
        DBMS_OUTPUT.PUT_LINE ('NUM: ' || I);
      END LOOP;
      
    EXCEPTION 
      WHEN OTHERS THEN
        DBMS_OUTPUT.PUT_LINE (SQLERRM);
    END;
    Oh, I´d also like to know how I can post the code here.
    Chears,

    Bruno

    Published by: brunosdiniz on 01/20/2009 03:33

    The following example shows the limit of the PLS_INTEGER...

    SQL> ed
    Wrote file afiedt.buf
    
      1  DECLARE
      2    NUM1 NUMBER := 2147483647; --59171108702;
      3    NUM2 NUMBER := 2147483647; --59171108702;
      4  BEGIN
      5   FOR I IN NUM1 .. NUM2 LOOP
      6     DBMS_OUTPUT.PUT_LINE ('NUM: ' || I);
      7   END LOOP;
      8* END;
    SQL> /
    NUM: 2147483647
    
    PL/SQL procedure successfully completed.
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  DECLARE
      2    NUM1 NUMBER := 2147483648; --59171108702;
      3    NUM2 NUMBER := 2147483648; --59171108702;
      4  BEGIN
      5   FOR I IN NUM1 .. NUM2 LOOP
      6     DBMS_OUTPUT.PUT_LINE ('NUM: ' || I);
      7   END LOOP;
      8* END;
    SQL> /
    DECLARE
    *
    ERROR at line 1:
    ORA-01426: numeric overflow
    ORA-06512: at line 5
    
    SQL>
    

    The latest example being for PLS_INTEGER 1 too.

  • by the way the variable counter between the loops

    I have a question about the passage of a variable counter between different events / while loops and seen an increase in value regardless of the loop is initiated.

    The fundamental problem is that I write file names unique to data collected on a spectrometer, and I would value at the end of the name of the file to increment every time that I collect the data. There are several different ways that I can collect the data, and I'd like the counter to increment when the collections is triggered. The attachment shows essentially what I'm trying to accomplish. Represent it buttons collect two different types of data I collect my instrument, but the counter variable is not passed correctly between the two loops. Is it possible that I can get the incrementing counter so that the two loops read the same value of counter?

    Thanks for your help.

    MICAH

    I can't look at your code since I'm on a phone. But you should really only have / need a structure of the event in a vi. The only exception I can think of is one to manage the events of the user and the other for GUI events. But even in this case there is no reason that I can think to need two.

  • Lessons on the looping and global variables in functions

    I'm trying to gather a complete inventory of virtual machines and hosts in my environment.  For VMS, I am train to collect the information below but problem a loop in the case of hard drives and network cards.  For example, on hard drives, I get the following result:

    VMNIC1: Network card 1
    NICMAC1: 00:50:56:87:01:e6
    NICNetwork1: dvPortGroup6666

    NICState1: Logged, GuestControl, StartConnected
    HDName1: hard drive 2
    StorageFormat1: thin
    HDCapacityGB1: 100
    Datastore1: [RXCXN00020] host108a/host108a_1.vmdk

    As you can see, only the last instance of the disc is saved in my outings.  In other words, HDNamex is never incremented but the value (here "drive 2") always represents the last disk that is, this virtual machine has two disks.  I have a few virtual methods with five disks and, in this case, there HDName 1 to a value of hard drive 5.  How properly I loop through each instance of my hard drives?

    A key part of my information on Virtual Machines is the Cluster they are on.  This value, however, is only available by attribute parent of the host object.  Therefore, I created a hash table to try to do that research, but it seems that the hash table is lost outside the function Get-HostInfo.  Note the Get-VMInfo function tries to access the values in this Hashtable with the following result:

    Cannot perform indexing in a null table.
    D:\scripts\VMInventory.ps1:36 tank: 82
    + $VMStuff | Add-Member-type noteproperty-name HostCluster-value $HostHashTa
    wheat [< < < < $VMStuff.Host]
    + CategoryInfo: InvalidOperation: (host012.domain.com:VMHostIm
    [of] pl), RuntimeException
    + FullyQualifiedErrorId: NullArray

    Looks like I need to be "global" and not just its function, this hash table.  Any help of any of these two issues would be greatly appreciated.  Here is my code:

    Function Get-HostInfo {}
    Begin {}
    {In process
    $HostStuff = new-object psobject
    $HostHashTable = @ {}

    $HostStuff | Add-Member-type noteproperty-name HostName-value $_
    $HostStuff | Add-Member-type noteproperty - name PowerState-value of $_. PowerState
    $HostStuff | Add-Member-type noteproperty-name CPUQty-value of $_. NumCpu
    $HostStuff | Add-Member-type noteproperty-name of generation - value $_. Build
    $HostStuff | Version-value add-Member-type noteproperty-name $_. Version
    $HostStuff | Add-Member-type noteproperty-name manufacturer-value of $_. Manufacturer
    $HostStuff | Add-Member-type noteproperty-name MemoryTotalGB-value of $_. MemoryTotalGB
    $HostStuff | Add-Member-type noteproperty-model name - value of $_. Model
    $HostStuff | Add-Member-type noteproperty-name NetworkInfo-value of $_.NetworkInfo
    $HostStuff | Add-Member-type noteproperty-name of Cluster - value of $_. Parent
    $HostStuff | Add-Member-type noteproperty-storage of value-name $_. StorageInfo

    $HostHashTable [$HostStuff.HostName] = $HostStuff.Parent

    write-output $HostStuff
    }
    {End}
    }

    Function Get-VMInfo {}
    Begin {}
    {In process
    $VMStuff = new-object psobject
    $VMHashTable = @ {}

    $VMStuff | Add-Member-type noteproperty - name VMName-value $_
    $VMStuff | Add-Member-type noteproperty-name Mnmemonic-value of $_. Folder
    $VMStuff | Add-Member-type noteproperty-name of the host - value $_. Host
    #Link the virtual machine to its location of cluster
    $VMStuff | Add-Member-type noteproperty-name HostCluster-$HostHashTable [$VMStuff.Host value]
    $VMStuff | Add-Member-type noteproperty - name PowerState-value of $_. PowerState
    $VMStuff | Add-Member-type noteproperty-name ProvisionedSpaceGB-value of $_. ProvisionedSpaceGB
    $VMStuff | Add-Member-type noteproperty-name UsedSpace-value of $_. UsedSpaceGB
    $VMStuff | Version-value add-Member-type noteproperty-name $_. Version
    #Get information about the adapter on each instance
    $AdapterInfo = get-NetworkAdapter $_
    {foreach ($Adapter to $AdapterInfo)
    $j = 1
    $VMStuff | Add-Member-type noteproperty-name VMNIC$ j-$Adapter.Name value
    $VMStuff | Add-Member-type noteproperty-name NICMAC$ j-$Adapter.MACAddress value
    $VMStuff | Add-Member-type noteproperty-name NICNetwork$ j-$Adapter.NetworkName value
    $VMStuff | Add-Member-type noteproperty-name NICState$ j-$Adapter.ConnectionState value
    $j ++
    } adapter #end foreach loop
    Information disk hard #Get for each instance
    $HardDisks = hard disk get $_
    {foreach ($HD in $Harddisks)
    $i = 1
    $VMStuff | Add-Member-type noteproperty-name HDName$ I have $HD value. Name - force
    $VMStuff | Add-Member-type noteproperty-name StorageFormat$ I have $HD value. StorageFormat-force
    $VMStuff | Add-Member-type noteproperty-name HDCapacityGB$ I have $HD value. CapacityGB-force
    $VMStuff | Add-Member-type noteproperty-name data store $ I have $HD value. Filename-force
    $i ++
    } foreach #end HD loop
    #Select the windows machines for obtaining information from WMI
    If ($_ - like "w *") {}
    $OSinfo = get-WmiObject-class Win32_OperatingSystem - computer $_
    $VMStuff | Add-Member-type noteproperty-name OSSerialNumber-$OSinfo.SerialNumber value
    $VMStuff | Add-Member-type noteproperty - name OSVersion-value $OSinfo.Version
    $VMStuff | Add-Member-type noteproperty-name OSVServicePack-$OSinfo.ServicePackMajorVersion value
    $VMStuff | Add-Member-type noteproperty-name OSCaption-$OSinfo.Caption value
    $VMStuff | Add-Member-type noteproperty-name OSInstallDate-$OSinfo.InstallDate value
    $VMStuff.OSInstallDate = ([WMI] "). ConvertToDateTime (($OSInfo). InstallDate). ToString ("yyyy-MM-DD hh: mm :") ")
    $VMStuff | Add-Member-type noteproperty-name OSLastBoot-$OSinfo.LastBootupTime value
    $VMStuff.OSLastBoot = ([WMI] "). ConvertToDateTime (($OSInfo). LastBootUpTime). ToString ("yyyy-MM-DD hh: mm :") ")
    $ComputerInfo = get-WmiObject-class Win32_ComputerSystem - computer $_
    $VMStuff | Add-Member-type noteproperty-name OSSystemType-$ComputerInfo.SystemType value
    IP #Get each adapter information
    $OSNICArray = @)
    $OSNICrecord = get-wmiobject Win32_NetworkAdapterConfiguration - filter IPEnabled = TRUE - computer $_. Select legend, IPAddress,: IPSubnet, DefaultIPGateway, DNSDomainSUffixSearchOrder and DNSServerSearchOrder
    $OSNICArray += $OSNICrecord
    {foreach ($LAN to $OSNICArray)
    $VMStuff | Add-Member-type noteproperty-name OSAdapterName-value $LAN. Legend
    $VMStuff | Add-Member-type noteproperty-name OSIPAddress-value $LAN. IPAddress
    $VMStuff | Add-Member-type noteproperty-name OSIPSubnet-value $LAN. : IPSubnet
    $VMStuff | Add-Member-type noteproperty-name OSGateway-value $LAN. DefaultIPGateway
    $VMStuff | Add-Member-type noteproperty-name OSDNSSearchOrder-value $LAN. DNSServerSearchOrder
    $VMStuff | Add-Member-type noteproperty-name OSDNSSuffix-$LAN.dnsdomainsuffixsearchorder value
    } foreach LAN #end loop
    } #end if

    $VMHashTable [$VMStuff.VMName] = $VMStuff.Host

    write-output $VMStuff
    }
    {End}

    }
    #Specify location to search
    $Location = 'My Place'
    SE connect-VIServer 'VIServer1 '.

    #Gather the host information
    $HostatSite = get-vmhost-location $Location
    $HostatSite | Get-Hostinfo
    #$HostatSite | Get-Hostinfo | export-csv "d:\scripts\server-report\'$Location'-HostReport.csv".

    #Gather VM information
    $VMatSite = get-vm-location $Location
    #$VMatSite | Get-VMInfo | export csv d:\scripts\server-report\$Location-VMReport.csv - NoTypeInformation
    #$VMatSite | Get-VMInfo | ConvertTo-Html | Set-Content d:\scripts\server-report\$Location-VMReport.htm
    $VMatSite | Get-VMInfo

    The problem is that the Export-CSV cmdlet examines the properties of the first record it only reads and displays the properties for all the records. You can leave the script write a dummy record as the first album with all the columns that are possible. That will solve this problem.

  • Declare the variable in the loop or abroad?

    What is the smartest, if the statement is a loop much like 100000. Is there a difference?

    * for(int i = 0; i < 100000; i++) {*}
    Dim myStr = getSomething();
    *}*

    or

    Dim myStr = "";
    * for(int i = 0; i < 100000; i++) {*}
    myStr = getSomething();
    *}*

    No, there is no performance difference (that's what you thought, weren't you).

    The basic rule by declaring variables is "the smallest scope possible. So in this case inside the loop for.

  • Variable to URL in the list of the loop

    I have a query in a loop that should receive a value of a url string, but I don't know how to reference the string variable in the loop. I get an error with my method.

    ? P1 = open

    ? P2 = open

    ? P3 = open

    etc etc.

    I have to loop through my query < cfloop from = "1" to = "#menu. ' RecordCount # ' index 'i' = >

    but, I want to place the url variable in the loop as well

    < ul rel = "#URL.p [i] #" > <!-it gives me an error.--> I can do this < ul rel = "#URL.p1 #" > and it works, but I need for the feature based on p1, p2, p3 etc. ""

    How could refer to this variable in a loop?


    #URL.p [i] #.

    Almost.  If your url variables are named p1, p2, etc, the syntax is:

    #URL [' p #i # '] #... OR

    #URL ['p' & I] #.

  • Bind the undeclared variable.

    Hi all

    When running a procedure get the below error:


    SQL > @task.sql
    SP2-0552: Bind 'MI' undeclared variable.





    DECLARE
      my_task_name   VARCHAR2 (30);
      my_sqltext     CLOB;
     BEGIN
    my_sqltext :='Select  a.billtext  CALL_TYPE, a.CALL_TYPE callDirection
    , to_char(transdate, 'dd/mm/yy')    CALLDATE
    , to_char(transdate, 'hh24:mi:ss')  CALLTIME
    , NVL(b_subno,'********')           CALLEDNUMBER
    , duration                          UNIT
    , billamount                        AMOUNT
    from
        selfcare.ESC_BP_CALL_DETAILS a, tabs.som_tabs_codes b
    where
        contrno ='1000097864'
        and SUBNO ='50033300'
        and LAST_TRAFFIC_DATE = '31-AUG-09'
        and  b.code= a.call_type
        AND b.CODENAME='CALL_TYPE'
        and chargeType  in (SELECT CODE FROM tabs.SOM_TABS_CODES
                                WHERE
                                    CODENAME='BILL_CHARGETYPE'
                                    AND PARTCODE in('CALL_LOCAL'))
        and TARIFF_GROUP IN (SELECT CODE FROM tabs.SOM_TABS_CODES
                                WHERE
                                    CODENAME='BILL_TARIFFGRP'
                                    AND PARTCODE in('CALL_LOCAL'))
    order by transdate asc)';
    my_task_name := dbms_sqltune.create_tuning_task (sql_text=> my_sqltext,
          bind_list     => sql_binds (anydata.convertnumber (9)),
              user_name     => 'SELFCARE'
             scope         => 'COMPREHENSIVE',
             time_limit    => 60,
              task_name     => 'SELFCARE1',
             description   => 'Testing Slow Running Online Payslip Run'
          );
       END;
      /
    Any idea what needs to be changed?


    Kai

    You must use 2 single quotes in your sqltext string:

    DECLARE
      my_task_name   VARCHAR2 (30);
      my_sqltext     CLOB;
     BEGIN
    my_sqltext :='Select  a.billtext  CALL_TYPE, a.CALL_TYPE callDirection
    , to_char(transdate, ''dd/mm/yy'')    CALLDATE
    , to_char(transdate, ''hh24:mi:ss'')  CALLTIME
    , NVL(b_subno,''********'')           CALLEDNUMBER
    , duration                          UNIT
    , billamount                        AMOUNT
    from
        selfcare.ESC_BP_CALL_DETAILS a, tabs.som_tabs_codes b
    where
        contrno =''1000097864''
        and SUBNO =''50033300''
        and LAST_TRAFFIC_DATE = ''31-AUG-09''
        and  b.code= a.call_type
        AND b.CODENAME=''CALL_TYPE''
        and chargeType  in (SELECT CODE FROM tabs.SOM_TABS_CODES
                                WHERE
                                    CODENAME=''BILL_CHARGETYPE''
                                    AND PARTCODE in(''CALL_LOCAL''))
        and TARIFF_GROUP IN (SELECT CODE FROM tabs.SOM_TABS_CODES
                                WHERE
                                    CODENAME=''BILL_TARIFFGRP''
                                    AND PARTCODE in(''CALL_LOCAL''))
    order by transdate asc)';
    
    my_task_name := dbms_sqltune.create_tuning_task (sql_text=> my_sqltext,
          bind_list     => sql_binds (anydata.convertnumber (9)),
              user_name     => 'SELFCARE'
             scope         => 'COMPREHENSIVE',
             time_limit    => 60,
              task_name     => 'SELFCARE1',
             description   => 'Testing Slow Running Online Payslip Run'
          );
       END;
      / 
    
  • Value of the loop variable for begins with the last entry of the previous run

    I have a problem with a loop for... I am a beginner with Labview and perhaps do not follow the order of events (since it runs not on a line-by-line as typical of programming languages), but I think that my problem is trivial.

    Say I'm running a loop for 16 iterations and I want to build a table which, for example, consists of four 0s, 1 4s, four 2s and 3 four s.   I initialize the array outside and using shift registers to be added to the matrix in the loop for.

    However, the first time I run the program I get funky results.  In subsequent runs, the first value in my table is a 3, and the rest of the rest of the table is moved down by 1, so I did that three 3s at the end (for example).

    Can someone help me understand how to solve this problem?

    Thank you

    George


  • Convert single while loop with variable Timing literal to the producer consumer

    I have a controller for a biological system that updates every n minutes or every minute 2n, under certain conditions. My app has a synchronization controller calculates if the current iteration is n or 2n and feeds the output of this calculation in a loop of "Timing" VI in my all. If I understand correctly, this is similar to the issuance of an order of sleep() in a language similar to C and should be avoided. I'm refactoring my code and I heard that they are well suited for this kind of things. Here's how it should work:

    1. Loop begins at the time T, T is saved.
    2. Schedule controller runs and calculates if loop will get minutes 2n or n minutes. This controller will take a number of milliseconds to complete, so we are is more to time T.
    3. Now that the update interval (n or 2n, let's call it u) is known, the loop must until T +u fill.
    4. The PDC is executed, but a number of milliseconds to execute.
    5. The rest of the time until the next iteration of loop should produce the CPU for other processes.

    It sounds to me like it's the kind of a real-time system, although as long as we are in the minute of the original deadline, there will be nothing wrong.

    What the producer-consumer loop would look like? Assumed that the synchronization and the main order controller are separate from the VI.


  • Variable is empty but the loop is executed

    Hello

    Can someone explain what follows...

    C:\ > $vms = Get - VM

    C:\ > $vms

    C:\ > foreach ($vm in $vms) {Write-Host "Test $vm"}

    Test

    C:\ > Get-PowerCLIVersion

    PowerCLI Version

    -


    VMware vSphere PowerCLI 4.1 build 264274

    Connected to an ESXi 4.1 root hosts, there is no VM then why the loop runs once? I know that to achieve the above, there are easier methods, but for other reasons, I need to loop, it was just a test to prove what is for me a phenomenon.

    Any help appreciated.

    Thank you, Andy.

    Post edited by: avarcher

    I believe that this is because PowerShell by assigning a null value to $vm.  If you want to avoid going there you can test $vm - eq $Null before you begin the ForEach, or you can use $vm = @(Get-VM).

    Dave

    VMware communities user moderator

    Now available - vSphere Quick Start Guide

    You have a system or a PCI with VMDirectPath?  Submit your specifications to Officieux VMDirectPath HCL.

  • How to make a loop with variable values depending on where you are in the loop

    Hello

    I need loops / nested loops that choose different figures depending on where you are in the loop.

    The entire function must operate at times 'ml '. 'ml' is a dynamic figure.

    Loop 1 = while the loop is the first 12 iterations, "exconemp" must be equal to 100. 13-24 iterations, 'exconemp' to 102.5 equal, for 25-36 TI 105.06, 37-48, it will be 107.69. This must change each 12th iteration until he reached 'ml '. The calculation takes the value of the previous 'exconemp' and then that multiply by 0.025.

    Loop 2 = while the loop is in 120 first iterations, 'abc' should be equal to 0.015 and additional iterations should use 0.01. It should also work in a way to know if 'ml' is greater or less than 120 and work accordingly.

    My main problem is - this - how can I get loops to go like this:

    While the iteration is < 12, to do this, THEN take the final figure (12th iteration) and begin the 13-24, make this SO etc etc.

    How to produce a THEN statement? I can get the code to pick up the final values, but does not change along the way.

    I think I might better create an array for loop 1, but I'm not entirely convinced of that. Also, I think it would be better/more net if I can get "month total 1 ' and ' month 2 total ' in loops, but do not know how to do this.

    The values I need to produce (only 36 first shown):

    1-12 = 125.55, 251,65, 378.31, 505.52, 633.29, 761.63, 890.53, 1019.99, 1150.03, 1280.63, 1411.81, 1543.57
    13-24 = 1679.05, 1815.12, 1951.79, 2089.06, 2226.93, 2365.41, 2504.50, 2644.20, 2784.52, 2925.45, 3067.00, 3209.18
    25-36 = 3355.19, 3501.85, 3649.15, 3797.11, 3945.71, 4094.96, 4244.87, 4395.44, 4546.68, 4698.57, 4851.14, 5004.38

    var ml = 240 / / dynamic figure, multiple of 12 up to 780
    var exconemp;
    var exconem = 100;
    var inf = 0.025;
    Tree var;
    var tec;
    power of the var;
    var fvis;
    var abc;
    var fvee;
    MVT var;
    function myfunction() {}

    Loop 1

    While (ml < = 12) {}
    exconemp = exconem;
    // }
    so that {(ml > 12)
    exconemp = exconem * inf;
    //}

    end loop 1

    trace ("exconemp =", exconemp); employee contribution

    tree = exconemp /(1-0.2)-exconemp;
    TEC = exconemp + tree;
    trace ('tree', tree);
    trace ("tec", tec);
    power = Math.pow (1 + 0.07, 1/12);

    Loop 2

    While (ml < = 120) {}
    ABC = 0.015;
    //}
    then {}
    ABC = 0.01;
    //}

    end loop 2

    fvis = power *(1-abc/12);
    trace ("fvis =", fvis);
    FVEE = tec * fvis;
    trace ("fvee =", fvee); month 1 total
    MVT = (CET + fvee) * fvis;
    trace ("MVT =", MVT); month 2 total
    //

    for (var i: Number = 0; i < ml; i ++)
    {
    MVT = (CET + MVT) * fvis;
    trace ("tfvloop =", MVT);
    }
    }

    I hope that I've explained this well enough.

    Thanks in advance.

    I think that will do it even if I don't quite get the numbers you posted.

    Stop();

    var ml = 48; figure dynamic, multiple of 12 up to 780
    var exconemp;
    var exconem = 100;
    var inf = 0.025;
    Tree var;
    var tec;
    power of the var;
    var fvis;
    var abc = 0.15;
    var fvee;
    MVT var;

    MyFunction();

    function myfunction()
    {
    exconemp = exconem;

    for (var index: uint = 1; index)<= ml;="">
    {
    trace(index + "--------------------------------");
               
    tree = exconemp /(1-0.2)-exconemp;
    TEC = exconemp + tree;
    power = Math.pow (1 + 0.07, 1/12);
    fvis = power *(1-abc/12);
    FVEE = tec * fvis;
                       
    if(index == 1)
    {
    trace ("month 1 total =", fvee);
    }
    another if (index == 2)
    {
    MVT = (CET + fvee) * fvis;
    trace ("month 2 total =", MVT); month 2 total
    }
    on the other
    {
    MVT = (CET + MVT) * fvis; now that we're here the MVT auto perpetuates on himself
    trace ("months" + index + "total =", MVT); month total n
    }
                       
               
    If (index %12 == 0)
    {
    exconemp = exconemp *(1+inf);
    trace ("changed to exconemp to:" + exconemp);
    }
               
    If (index % 120 == 0)
    {
    ABC =. 01;
    trace ("changed abc to:" + abc);
    }
               
    }
    }

  • Link with a URL Variable Web buttons

    Hey all:

    I asked my question above in the general section of the forum InDesign, but a useful user suggested I repost it here since it will take a few magical scripts to accomplish:

    My task of the end work has developed an interactive PDF catalogue of our products that my superior can digitally distribute and allow to navigate potential customers without accessing the website.

    We have an Excel file which lists all the details of our products - name, description, title, image, category, etc. I used the data merge to create this 300 page document rather than the hand-copy each product information on a single page.

    Unfortunately, I'm stuck now - I designed the catalog so that I have an image I want to make a button that, if the person wishes to buy a product, will take them directly the the product page online where he or she can add it to your cart. That's fine, but I can't seem to find a way to make the image button link a variable like the rest of the page content. Each product page links are included in the CSV file, but without a method of variable web link, I create unique links individually, which kinda defeated the purpose of using merge data anyway.

    So my question is this - is there a way to make a button URL (image) have a web link function that can read from a CSV file and change each page like any other imported content? If not, is there another way to automate the process of individual link without placement on each page generated?

    Thanks in advance,

    Asher

    If you use the above code to verify the script tag, it will have to go inside the loop for (i) , replacing the "b = p.buttons [0]" line. However, there was a typing error, because I put t button and instead I should have put b for the button.

    Yes, a group. If you know that there is a single group on the page, so you don't even have to loop through the groups. Instead you can use:

    t = p.groups[0].textFrames[0];
    b = p.groups[0].buttons[0];
    

    Of course, it will break if there is never more than one group.

  • Problems with the scope of variables or reference (AS2)

    Hello!

    The code simple below maps onRelease functions to 8 buttons.
    The goal is to load the image into a single central imagePanel whenever a button is clicked.

    There are 8 instances of the same MC on the stage (called g0 to g7), each containing a button (btnShow)

    The function 'downloadImage()' load the image when the onRelease event is triggered.
    Each image file path is taken from the _global.paintings Array (the url property).

    The problem:
    It looks like this, during the transfer, a link for the "removal" of the 'I' variable, instead of its VALUE.
    So, at runtime, the 'I' is equal to 8 (value at the end of the loop for EACH function of downloadImage), instead of the value incremented (0 to 7)...

    Leading to each button of the same image, rather than the corresponding image loading (end of the url in _global.paintings property [0] to [7])

    Well, not easy to explain properly, I hope you understand what I mean...

    Thank you very much for your help, I am quite lost here!
    See you soon
    Luca


    =======

    Try this:

    function formatGal() {}

    for (var i: Number = 0; i<8; i++)="">
    . _root ["g" + i] btnShow.myIndex = i;
    _root ["g" + i].btnShow.onRelease = function() {}
    downloadImage (_global.paintings [this.myIndex] .url);
    trace (this.myIndex);
    }
    }
    }

    --
    Dave-
    Developer leader
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.Adobe.com/communities/experts/

Maybe you are looking for

  • Complete e-mail storage, no email

    Hello Last a few weeks, I was on holiday and in the Middle a vacation, I received an email that my credit card no longer works and I couldn't buy new storage iCloud, unable to solve the problem on vacation I had to go 7 days without upgrade. Now I fi

  • I have windows 8.1 and Fox firefox more recipe, I can't work recipefox even after I reinstalled it twice

    I uninstalled and reinstalled java firefox and recipefox 5 times now and I can't recipefox to work, it will not display sites of recipe can help you

  • Update iOS affects storage?

    I thought about it for a long time now. Ios updates use memory? I mean, when I look at the use of the storage list, in case theres a new update, new update ios x.x.x says ~ 400 MB. So, if I deciede to update, I never will have 400 MB less storage to

  • Constant error message trying to download El Capitan

    Hey all,. I recently had to upgrade my hard drive and do a BONE re - install via the internet retrieval. Since my Macbook Pro is end of 2011 he reinstalled Lion. I tried to upgrade to El Capitan, because I can't use all my apps to work - I need Photo

  • Windws xp error 0 x 80244019

    I bought a computer with windows xp home edition.  the computer has been restored to manufacture and reloaded windows.  I try to get updates to windows, but I get an error message 0 x 80244019.  What should I do to override that?