Зебра тв
Зебра тв

Reputation: 1

TRIGGER | FOR LOOP OR CURSOR USING FOR VARIABLE PL/SQL

I want to try insert loghis of table into one column for saving spaces

before  Delete on SmtTable
for each row
declare
v_loghis SmtTable%rowtype;
v_tabVar varchar2(2000);
begin
v_loghis.empo :=  'old' || :old.empo;
v_loghis.name :=  'old' || :old.name
v_loghis.adress:= 'old  || :old.adress';

here what i can use for inserting v_loghis into one column

for r in v_loghis
loop
v_tabVar := ':' || r.vloghis ;
end loop
insert into TabHis(col1) values(v_tabVar);
end;

was error v_loghis not cursor..

Upvotes: 0

Views: 100

Answers (1)

Littlefoot
Littlefoot

Reputation: 142798

for saving spaces

You must be kidding. You won't save any space, but create a nightmare for future revisions of data you store.

Because, your next question will be:

I have a long string that looks like this: "old.7369:old.SCOTT:old.Traffalgar Square 23/A, London". How do I join this "7369" EMPO column value to EMPLOYEES table?

Shortly: don't do that. If you're performing some kind of an audit, then store each column separately.

Don't forget the timestamp column (so that you'd know when something happened) and operation (insert/update/delete) that caused that row to be inserted into the audit table.

Upvotes: 1

Related Questions