- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Loop using a variable.
Operating System - HP-UX
1748036
Members
4793
Online
108757
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-21-2010 04:01 AM
тАО12-21-2010 04:01 AM
Loop using a variable.
Hi
Is there a way to loop through a variable and with the value in that variable I have to insert into the table.
eg.,
colors = {'BLUE','BLACK','ORANGE','YELLOW'};
loop
for each value (:value)in color
insert into the table
(col1,
col2,
color
)
values
(val1,
val2,
:value
);
end loop;
Is there a way to loop through a variable and with the value in that variable I have to insert into the table.
eg.,
colors = {'BLUE','BLACK','ORANGE','YELLOW'};
loop
for each value (:value)in color
insert into the table
(col1,
col2,
color
)
values
(val1,
val2,
:value
);
end loop;
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-21-2010 04:20 AM
тАО12-21-2010 04:20 AM
Re: Loop using a variable.
please check the below example
=======================================
SQL>
SQL> -- display data in the table
SQL> select * from Employee
2 /
no rows selected
SQL>
SQL>
SQL>
SQL>
SQL> BEGIN
2 FOR v_LoopCounter IN 1..10 LOOP
3 INSERT INTO employee (id)
4 VALUES (v_LoopCounter);
5 END LOOP;
6 END;
7 /
PL/SQL procedure successfully completed.
SQL>
SQL> select * from employee;
ID FIRST_NAME LAST_NAME START_DAT END_DATE SALARY CITY DESCRIPTION
---- -------------------- -------------------- --------- --------- ---------- ---------- ---------------
1
2
3
4
5
6
7
8
9
10
10 rows selected.
SQL>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-21-2010 04:30 AM
тАО12-21-2010 04:30 AM
Re: Loop using a variable.
Hi Kemo, Thanks for the reply.
If its a integer counter, i can increment and pass the value to the insert statement.
How to do this if its a set of string variable?
for str_counter in ('STR1', 'STR2','STR3') -- is this type of implementation possible??
If its a integer counter, i can increment and pass the value to the insert statement.
How to do this if its a set of string variable?
for str_counter in ('STR1', 'STR2','STR3') -- is this type of implementation possible??
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP