<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Question about insert statemnet in a while true loop in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/question-about-insert-statemnet-in-a-while-true-loop/m-p/2743349#M944044</link>
    <description>hi jeanine,&lt;BR /&gt;I thought of an idea, I learn on how to write&lt;BR /&gt;a cursor for loops, and in this i do the update&lt;BR /&gt;a. can a for loop to be in a while true loop.. &lt;BR /&gt;i don't see any problem..as i write it, do you?&lt;BR /&gt;b. i can also create a procedure to do this?&lt;BR /&gt;c. please let me know if you have any idea on &lt;BR /&gt;how to generate a bunch of character.&lt;BR /&gt;&lt;BR /&gt;create procedure tester0 IS&lt;BR /&gt;declare &lt;BR /&gt;high_pctinc constant number(10,5) :=1.50;&lt;BR /&gt;med_pctinc constant number (10,5) :=1.20;&lt;BR /&gt;low_pctinc constant number (10,5) :=1.10;&lt;BR /&gt;my_salary employee1.salary%TYPE;&lt;BR /&gt;my_empid employee1.empid%TYPE;&lt;BR /&gt;cursor employee1_crsr (low_end in VARCHAR2, high_end in VARCHAR2)&lt;BR /&gt;IS select empid, salary, from employee1&lt;BR /&gt;WHERE UPPER(substr(lastname,1,1))&lt;BR /&gt;BETWEEN UPPER(low_end) and UPPER(high_end);&lt;BR /&gt;numcount number; &lt;BR /&gt;begin &lt;BR /&gt;numcount:=0; &lt;BR /&gt;while true loop &lt;BR /&gt;numcount:=numcount+1; &lt;BR /&gt;insert into employee values (numcount,'dfadf', 789.90); &lt;BR /&gt;insert into employee (salary) values (800.00);&lt;BR /&gt;insert into employee (emp_name) values ('dlkjgl');&lt;BR /&gt;for my_employeerec IN employee1_crsr('B','X') loop&lt;BR /&gt; if my_emprec.empid &amp;lt; 100000 then&lt;BR /&gt;    UPDATE employee1 set salary = my_employeerec.salary*high_pctinc;&lt;BR /&gt;    where empid = numcount;&lt;BR /&gt; elsif my_emprec.empid &amp;lt; 3000000 then&lt;BR /&gt;    update employee1 set salary = my_employeerec.salary*low_pctinc;&lt;BR /&gt;    where empid = numcount;&lt;BR /&gt; else&lt;BR /&gt;    update employee1 set salary = myemployeerec.salary*med_pctinc;&lt;BR /&gt;    where empid = numcount;&lt;BR /&gt; end if;&lt;BR /&gt;end loop;&lt;BR /&gt;end loop; &lt;BR /&gt;end; &lt;BR /&gt;</description>
    <pubDate>Wed, 12 Jun 2002 21:39:08 GMT</pubDate>
    <dc:creator>Deanna Tran</dc:creator>
    <dc:date>2002-06-12T21:39:08Z</dc:date>
    <item>
      <title>Question about insert statemnet in a while true loop</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-about-insert-statemnet-in-a-while-true-loop/m-p/2743347#M944042</link>
      <description>this is the script that I used to fillup the tablespace....and my question is the following..&lt;BR /&gt;I created a table with 3 field  :&lt;BR /&gt;empid number, employee_name  and salary number.&lt;BR /&gt;a.  base on the script, the only value that will be changing is the numcount...but if i also want the system to generate the random data for the second value in term of varchar, how do i do that?&lt;BR /&gt;do i just add more insert state like &lt;BR /&gt;insert into employee value (numcount,'ddgdg')...?&lt;BR /&gt;b. if the table has 3 field, can i just insert 1 field instead of 3? &lt;BR /&gt;c. in addition, i want to perform update as well, within the while loop...as welll&lt;BR /&gt;&lt;BR /&gt;declare&lt;BR /&gt;my_empid employee.empid%TYPE:=234;&lt;BR /&gt;my_salary salary.employee%TYPE:=10,000;&lt;BR /&gt;numcount number;&lt;BR /&gt;begin&lt;BR /&gt;numcount:=0;&lt;BR /&gt;while true loop&lt;BR /&gt;numcount:=numcount+1;&lt;BR /&gt;insert into employee value (numcount,'dfadf', 789.90);&lt;BR /&gt;update employee set salary = my_salary + 10,000&lt;BR /&gt;where empid = my_empid; &lt;BR /&gt;end loop;&lt;BR /&gt;end;    &lt;BR /&gt;thank you for your help...</description>
      <pubDate>Wed, 12 Jun 2002 19:12:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-about-insert-statemnet-in-a-while-true-loop/m-p/2743347#M944042</guid>
      <dc:creator>Deanna Tran</dc:creator>
      <dc:date>2002-06-12T19:12:09Z</dc:date>
    </item>
    <item>
      <title>Re: Question about insert statemnet in a while true loop</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-about-insert-statemnet-in-a-while-true-loop/m-p/2743348#M944043</link>
      <description>a)  I'll have to think about a good way to do that one.  &lt;BR /&gt;&lt;BR /&gt;b)  Yes, as long as the other columns do not have not null constraints.  If your are not inserting into all of the fields in the order that they exist in the table than you specify which fields you are inserting as part of the insert statement.  Your statement would look like "insert into employee (empid) values (numcount);"&lt;BR /&gt;&lt;BR /&gt;c) for the update, I would do "update empolyee set salary = salary + 10000 where empid = numcount;"  This would update the row that you just inserted.</description>
      <pubDate>Wed, 12 Jun 2002 19:42:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-about-insert-statemnet-in-a-while-true-loop/m-p/2743348#M944043</guid>
      <dc:creator>Jeanine Kone</dc:creator>
      <dc:date>2002-06-12T19:42:32Z</dc:date>
    </item>
    <item>
      <title>Re: Question about insert statemnet in a while true loop</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/question-about-insert-statemnet-in-a-while-true-loop/m-p/2743349#M944044</link>
      <description>hi jeanine,&lt;BR /&gt;I thought of an idea, I learn on how to write&lt;BR /&gt;a cursor for loops, and in this i do the update&lt;BR /&gt;a. can a for loop to be in a while true loop.. &lt;BR /&gt;i don't see any problem..as i write it, do you?&lt;BR /&gt;b. i can also create a procedure to do this?&lt;BR /&gt;c. please let me know if you have any idea on &lt;BR /&gt;how to generate a bunch of character.&lt;BR /&gt;&lt;BR /&gt;create procedure tester0 IS&lt;BR /&gt;declare &lt;BR /&gt;high_pctinc constant number(10,5) :=1.50;&lt;BR /&gt;med_pctinc constant number (10,5) :=1.20;&lt;BR /&gt;low_pctinc constant number (10,5) :=1.10;&lt;BR /&gt;my_salary employee1.salary%TYPE;&lt;BR /&gt;my_empid employee1.empid%TYPE;&lt;BR /&gt;cursor employee1_crsr (low_end in VARCHAR2, high_end in VARCHAR2)&lt;BR /&gt;IS select empid, salary, from employee1&lt;BR /&gt;WHERE UPPER(substr(lastname,1,1))&lt;BR /&gt;BETWEEN UPPER(low_end) and UPPER(high_end);&lt;BR /&gt;numcount number; &lt;BR /&gt;begin &lt;BR /&gt;numcount:=0; &lt;BR /&gt;while true loop &lt;BR /&gt;numcount:=numcount+1; &lt;BR /&gt;insert into employee values (numcount,'dfadf', 789.90); &lt;BR /&gt;insert into employee (salary) values (800.00);&lt;BR /&gt;insert into employee (emp_name) values ('dlkjgl');&lt;BR /&gt;for my_employeerec IN employee1_crsr('B','X') loop&lt;BR /&gt; if my_emprec.empid &amp;lt; 100000 then&lt;BR /&gt;    UPDATE employee1 set salary = my_employeerec.salary*high_pctinc;&lt;BR /&gt;    where empid = numcount;&lt;BR /&gt; elsif my_emprec.empid &amp;lt; 3000000 then&lt;BR /&gt;    update employee1 set salary = my_employeerec.salary*low_pctinc;&lt;BR /&gt;    where empid = numcount;&lt;BR /&gt; else&lt;BR /&gt;    update employee1 set salary = myemployeerec.salary*med_pctinc;&lt;BR /&gt;    where empid = numcount;&lt;BR /&gt; end if;&lt;BR /&gt;end loop;&lt;BR /&gt;end loop; &lt;BR /&gt;end; &lt;BR /&gt;</description>
      <pubDate>Wed, 12 Jun 2002 21:39:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/question-about-insert-statemnet-in-a-while-true-loop/m-p/2743349#M944044</guid>
      <dc:creator>Deanna Tran</dc:creator>
      <dc:date>2002-06-12T21:39:08Z</dc:date>
    </item>
  </channel>
</rss>

