Home > database >  Declare in the oracle
Declare in the oracle

Time:10-11

How to use declare in oracle? Declare... The begin... Finished after the execution: why not? Command blocks need to compile? How to compile? What's the statement?

CodePudding user response:

Don't need to compile, direct execution, reference:
 DECLARE 
I NUMBER;
The BEGIN
I:=1;
WHILE (I & lt;
=500)LOOP
INSERT INTO test1 VALUES (I, TO_CHAR (TO_DATE (I, 'j'), 'JSP'));
I:=I + 1;
END LOOP;
END;

CodePudding user response:

reference 1st floor modb_pro response:
don't need to compile, direct execution, reference:
 DECLARE 
I NUMBER;
The BEGIN
I:=1;
WHILE (I & lt;
=500)LOOP
INSERT INTO test1 VALUES (I, TO_CHAR (TO_DATE (I, 'j'), 'JSP'));
I:=I + 1;
END LOOP;
END;
/
set two variables, counting to distinguish between a and b, variable initial stage, a searchable database, and then the whole cycle, if to retrieve the return value is normal, it traverses the retrieved data, the data is written to handle file, technology accumulation, b if retrieve the return value of the anomaly is the distinction between a set to 2, if the distinction between a is equal to zero, the list of retrieved project update,

CodePudding user response:

refer to the second floor weixin_46151807 response:
Quote: refer to 1st floor modb_pro response:
don't need to compile, direct execution, reference:
 DECLARE 
I NUMBER;
The BEGIN
I:=1;
WHILE (I & lt;
=500)LOOP
INSERT INTO test1 VALUES (I, TO_CHAR (TO_DATE (I, 'j'), 'JSP'));
I:=I + 1;
END LOOP;
END;
/
set two variables, counting to distinguish between a and b, variable initial stage, a searchable database, and then the whole cycle, if to retrieve the return value is normal, it traverses the retrieved data, the data is written to handle file, technology accumulation, b if retrieve the return value of the anomaly is the distinction between a set to 2, if you tell a is equal to zero, the list of retrieved project updates,
if distinguish is 0, the processing number to log in, if the distinction between a is 2 writes the error messages in the log

CodePudding user response:

You have to tell me about your bad to use, what is bad to use, had better post your code and execution process,
  • Related