I want to create an Oracle Stored procedure. I will pass in the database name and the parameters name. I want to check the datatype of the field and if it is a CLOB already, I don't want to do the stored procedure.
Can someone help me?
COLNAME and xxx will be passed in.
They are the field column name and the table name.
I want to check if the column name of this table is a varchar2, and not already a clob, and if not, run it...
if COLNAME = varchar2(4000) then
alter table xxx add y_copy varchar2(4000);
update xxx set y_copy = COLNAME;
update xxx set COLNAME = null;
alter table xxx modify COLNAME long;
if colname type = long then
alter table xxx modify COLNAME clob;
if colname type = clob then
update xxx set COLNAME = y_copy;
if exists y_copy
alter table xxx drop column y_copy;
I may not need to do all the if statements, but I want it to take up where it left off if it fails in the middle.