plsql loop statement

2011-09-08  来源:本站原创  分类:Database  人气:97 

for loop

- Set serveroutput on
begin
for i in 1 .. 3
loop
insert into tbl_test (name, age) values ​​('name', 2);
end loop;
end;

while loop

declare
vcount number (2): = 1;
vnum number (10): = 1;
begin
while vcount <6
loop
vnum: = vnum +1;
vcount: = vcount +1;
end loop;
end;

declare
vid number (10): = 1;
vorderno number (10): = 1;
begin
for i in 1 .. 1000
loop
insert into tbl_feifei_test (id, time, orderNo, tile, amount, accountNo, tradeType, user, chail, fetchDAte) values
(Vid, to_date ('2008-01-01 00:00:00 ',' yyyy-mm-dd hh24: mi: ss'), vorderno,'', 100, 'feifei', 'A', 'feifei' , '10177 ', sysdate);

vid: = vid +1;
vorderno: = vorderno +1;

end loop;
end;

相关文章
  • plsql loop statement 2011-09-08

    for loop - Set serveroutput on begin for i in 1 .. 3 loop insert into tbl_test (name, age) values ​​('name', 2); end loop; end; while loop declare vcount number (2): = 1; vnum number (10): = 1; begin while vcount <6 loop vnum: = vnum +1; vcount: = vc

  • sql and plsql loop insert test data 2010-03-22

    ================== sql insert the test data ========= cycle number strxxx number str 1 aaa 1 a 2 aaa 2 b 3 aaa 3 c 4 ccc 4 d 5 ccc 5 e declare @ number int, @ string varchar (10) select @ number = number from table1 where strxxx = 'aaa' select @ str

  • The loop statement PHP 2010-08-01

    PHP loop in the same block of code used to perform a specified number of times. Loop in your code, you often need to run the same block of code many times. You can use the loop statement in the code to accomplish this task. In PHP, we use the followi

  • sql / plsql loop into the test data 2011-09-25

    ================= Sql loop insert test data ========= number strxxx number str 1 aaa 1 a 2 aaa 2 b 3 aaa 3 c 4 ccc 4 d 5 ccc 5 e declare @ number int, @ string varchar (10) select @ number = number from table1 where strxxx = 'aaa' select @ str = str

  • PL-SQL Advanced Tutorial 2010-09-26

    PLSQL premium content 1, PLSQL to accept the value of the dynamic input Using PL / SQL block can also query the database. You can use & to get user input. Syntax: variable name: variable name = & input; Example: an employee asks for the number sho

  • plsql cursor Xiang Jie - cursor cursor parameters and parameters not the same thing 2010-09-27

    Just open when the cursor is located in a blank line, use the fetch into to get to the first line. Just pay attention to when using update cursor, not the cursor during the commit. Otherwise, report ORA-01002: fetch out of sequence Is COMMIT; lead to

  • Detailed plsql cursor - the cursor with the cursor parameters and parameters not the same thing 2010-09-27

    Just open when the cursor is located in a blank line, use the fetch into to get to the first line. Just be careful when using updatable cursors, the cursor can not be during the commit. Otherwise it will report ORA-01002: fetch out of sequence Is COM

  • PLSQL development foundation - structural control 2011-04-07

    -- Anonymous block set serveroutput on; begin dbms_output.put_line('this is an anonymous block'); end; / -- No data are not considered abnormal declare v_sname varchar2(200); begin select name into v_sname from students t where t.student_id=10381; db

  • plsql strengthen the case / when / then 2010-07-19

    Oracle / PLSQL: Case Statement -------------------------------------------------- ------------------------------ In Oracle 9i, you can use the case statement within an SQL statement. It has the functionality of an IF-THEN-ELSE statement. Translation:

  • plsql transaction processing (a) 2010-12-08

    4, transaction processing Oracle is transaction-based, oracle user transactions to ensure data integrity. A transaction is a series of data manipulation sql statement as a logical unit, logical unit inside a single operation or all do, or all do, to

  • oracle PL / SQL basic composition, structure, control statements, branch structure, selection structures, loop loop structure 2010-12-08

    Branch of the branch structure is the basic program structure, branch structure, achieved by the IF statement. Using the IF statement, condition can change the program according to the logic of the process. IF statement has the following form: IF con

  • oracle PL / SQL basic composition, structure, control statements, branch structure, choose the structure, loop loop structure 2010-12-08

    Branch structure of the branch structure is the most basic program structure, branch structure, achieved by the IF statement. Using the IF statement, according to the conditions can change the program logic flow. IF statement has the following form:

  • oracle notes (j) loop 2011-04-13

    Loop The basic cycle is called an unconditional loop, if the exit statement is not specified, the loop will be unconditionally implemented, this cycle is called an infinite loop, loop to avoid. Syntax is as follows: Loop --- Statement --- Exit when condit

  • oracle stored procedure declared variable. for loop 2011-05-10

    oracle stored procedure, declare a variable, for loop 1, create a stored procedure create or replace procedure test (var_name_1 in type, var_name_2 out type) as - Declare a variable (variable type variable name) begin - Body of stored procedure execu

  • qlsql learning example code 1 2010-03-30

    Preparation: create table DEPT ( DEPTNO NUMBER (2) not null, DNAME VARCHAR2 (14), LOC VARCHAR2 (13) ) alter table DEPT add constraint PK_DEPT primary key (DEPTNO); insert into DEPT (DEPTNO, DNAME, LOC) values (10, 'ACCOUNTING', 'NEW YORK'); insert in

  • sqlplus common command - turn 2010-07-29

    show and the set command is used to maintain the two SQL * Plus system variables in order SQL> show all - View all 68 values of system variables SQL> show user - Display the current connected users SQL> show error - error SQL> set heading off

  • Oracle PL / SQL in the use of cursors and cursor variables 2010-11-11

    What is the cursor: Cursor is literally swimming in the cursor. Database language used to describe: the cursor is a row in the result set mapping the location of the data entities, with the cursor the user can access any row result set, and will plac

  • Oracle PL / SQL based 2010-11-11

    Each database has its own unique language, Oracle is PL_SQL the following. It is relative to the SQL language, providing a branch and recycling, more work can be completed. PL-SQL: --- SQL statement with the selection process. Similar to each databas

  • Oracle PL / SQL cursors and cursor variables in the use of 2010-11-11

    What is the cursor: Cursor is literally swimming in the cursor. Database language used to describe: the cursor is a row in the result set mapping the location of the data entities, with the cursor the user can access any row result set, and will plac

  • frequently used commands sqlplus 2010-11-30

    show and the set command is used to maintain the two SQL * Plus system variable order SQL> show all - View all 68 values of system variables SQL> show user - Display the current connected users SQL> show error - error SQL> set heading off - di