Home > database >  Consult a great god
Consult a great god

Time:10-03

DECLARE
V_BH VARCHAR2 (50);
V_STATUS number;
V_SQL VARCHAR2 (500);
The BEGIN
V_BH:='H53070219001';
FOR CS IN (SELECT T.T ABLE_NAME, tc OLUMN_NAME from user_tab_columns T) LOOP
V_SQL:='SELECT COUNT (*) FROM' | | CS, TABLE_NAME | | 'WHERE' | | CS. COLUMN_NAME | | '=' ' '| | V_BH | |' ' 'AND 1=1 ";
The EXECUTE IMMEDIATE V_SQL INTO V_STATUS;

IF V_STATUS & gt; 0 THEN
INSERT INTO ZJZ_TEMP ('s VC1 and VC2 that vc33) VALUES (CS) TABLE_NAME, CS COLUMN_NAME, V_STATUS);
END the IF;
COMMIT;
END LOOP;
END;

I want to check the list of the field value is' H53070219001 'but this code error

Ora - 01722: invalid number
Ora - 06512: the at line 9

Really don't know what's wrong

CodePudding user response:

 
FOR CS IN (SELECT T.T ABLE_NAME, tc OLUMN_NAME from user_tab_columns T) LOOP
- add a condition
FOR CS IN (SELECT T.T ABLE_NAME, tc OLUMN_NAME from user_tab_columns T
Where data_type in (' VARCHAR2 ', 'CHAR')

)

CodePudding user response:

Thank god ~ ~ ~

CodePudding user response:

Cs variables don't need a statement first?
  • Related