Thanks for pointing this out. I can change it so it works as long as you don't use the msdaora OLEDB provider. Why? Because for some versions of the msdaora oledb provider I found that this query failed:
select dbms_metadata.get_ddl('VIEW','MyView','MySchema') from dual
but this one does not:
select cast(dbms_metadata.get_ddl('VIEW','MyView','MySchema') as varchar2(4000)) from dual
I believe the first query fails because msdaora does not handle CLOB data correctly, which is what get_ddl() returns.
I'll post back here when I have a fix for this.