--1 Get DDL of the object:
declare
clb CLOB; pos INTEGER:=1; amt INTEGER; len INTEGER; txt VARCHAR2(4000);
begin
clb := dbms_metadata.get_ddl ('$OBJ_TYPE','$OBJ_NAME','$OWNER');
len := LENGTH(clb);
LOOP
amt := nvl(INSTR (clb, chr(10), pos),len) - pos;
IF amt>0 THEN txt := NVL(SUBSTR (clb, pos, amt),' '); ELSE txt:=''; END IF;
pos := pos + amt + 1;
DBMS_OUTPUT.put_line (SUBSTR(txt,1,250));
EXIT WHEN pos>=len;
END LOOP;
end;
/
--2 Get DDL of all $OBJ_TYPE objects in schema:
declare
clb CLOB; pos INTEGER; amt INTEGER; len INTEGER; txt VARCHAR2(4000);
handle NUMBER; transhandle NUMBER; cnt NUMBER;
begin
handle := dbms_metadata.open ('$OBJ_TYPE');
--dbms_metadata.set_filter (handle, 'NAME_EXPR','like ''%''');
dbms_metadata.set_filter (handle, 'SCHEMA', '$OWNER');
dbms_metadata.set_count (handle, 10);
transhandle := dbms_metadata.add_transform (handle, 'DDL');
dbms_metadata.set_transform_param (transhandle, 'SQLTERMINATOR', TRUE);
LOOP
clb := dbms_metadata.fetch_clob (handle);
EXIT WHEN clb is null;
pos := 1;
len := LENGTH(clb);
txt := '';
LOOP
amt := nvl(INSTR (clb, chr(10), pos),len) - pos;
IF amt>0 THEN txt := NVL(SUBSTR (clb, pos, amt),' '); ELSE txt:=''; END IF;
pos := pos + amt + 1;
DBMS_OUTPUT.put_line (SUBSTR(txt,1,250));
EXIT WHEN pos>=len;
END LOOP;
END LOOP;
end;
/
1 comment:
air jordans
burberry outlet online
michael kors outlet online
michael kors handbags
coach outlet
timberland boots
louis vuitton handbags
basketball shoes
cheap oakley sunglasses
nike store
louis vuitton handbags
michael kors outlet online
nike nfl jerseys
coach factory outlet
nike air force 1
fake watches
ed hardy clothing
tiffany jewelry
louis vuitton outlet
air jordan pas cher
cheap oakley sunglasses
jordan shoes
christian louboutin outlet
celine handbags
christian louboutin outlet
adidas shoes
oakley outlet
ray ban sunglasses outlet
louis vuitton outlet
ray ban sunglasses
coach outlet
nike air max 90
coach factory outlet
cheap toms shoes
timberland outlet
coach outlet
jordans
ralph lauren polo
coach outlet
jordan 4 toro
20166.4wengdongdong
Post a Comment