Pepe TD Vo wrote: > thank you Ms. Albe, I am male, but never mind. > I have tried that and still not working. It passed that error and then complained about the shema, cidr_staging does not exist and/or c1 (cursor) is not exist. when I take it out, it complained invalid type name for those below: > v_Rec_Num cidr_staging.stg_i864.receipt_number%type; > v_Dat_Ent cidr_staging.stg_i864.date_entered%type; > v_Seq_Num cidr_staging.stg_i864.sequence_number%type; Works fine for me: CREATE TABLE laurenz.test(id integer); DO $$DECLARE t laurenz.test.id%TYPE; BEGIN t := 1; END;$$; You should probably share the rest of your code + the exact error messages so we can spot the error. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com