Database Administration (MOSC)

MOSC Banner

problem with dbms_metadata.get_ddl in plsql

edited Aug 26, 2010 11:30PM in Database Administration (MOSC) 3 commentsAnswered ✓
 Hi,
How can I used the dbms_metadata.get_ddl in pl/sql and insert the INDEX source in a table.I am using the following code but getting 'ORA-01422: exact fetch returns more than requested number of rows'


set serveroutput on
declare
 lv_object_type   varchar2(30);               
 lv_buffer_1        varchar(4000);
 lv_buffer_2        varchar(4000);
begin                                                 
  insert into  gtt_1  select to_char(dbms_metadata.get_ddl( 'MATERIALIZED_VIEW','COM_CUST_PROD_AGG_MV1','T709374')) from dual   ;             
  dbms_output.put_line(lv_buffer_1) ;     
  commit ;
end; 


when I run the following select on sqlplus :
select to_char(dbms_metadata.get_ddl( 'MATERIALIZED_VIEW','COM_CUST_PROD_AGG_MV1','T709374')) from dual   ;

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center