I need to fill a table column (in Oracle database) with string values that have variable part, e. g. AB0001, AB0002,...,AB0112...,AB9999, where AB is constant string part, 0001 -9999 is variable number part. i've tried the following solution in SQL for a table with 2 columns:
create table tbl1 (seq1 number(8), string1 varchar(32));
declare tst number(8) :=0; begin for cntr in 1..100 loop tst := cntr; insert into TBL1 values (someseq.nextval, concat('AB',tst)); end loop; end;
But in this case I get STRING1 filled with values AB1,AB2,...,AB10,.. which is not exactly what I need. How should I modify my script to insert values like AB0001,...,AB0010?
Aucun commentaire:
Enregistrer un commentaire