-- drop table if exists
DROP TABLE your_table;
-- create sample table
CREATE TABLE your_table
(
report VARCHAR2 ( 10 )
, exhibit VARCHAR2 ( 10 )
, param VARCHAR2 ( 10 )
);
-- insert test values
INSERT INTO your_table ( report
, param )
VALUES ( 'myreport'
, 'report' );
INSERT INTO your_table ( exhibit
, param )
VALUES ( 'myexhibit'
, 'exhibit' );
COMMIT;
-- show table
SELECT *
FROM your_table;
-- add content column
ALTER TABLE your_table ADD content varchar2(100);
-- update content column
UPDATE your_table
SET content =
CASE param
WHEN 'report' THEN report
WHEN 'exhibit' THEN exhibit
ELSE NULL
END;
COMMIT;
-- show the new table
SELECT *
FROM your_table;
|