I have a view in my production database and I want to create same view in my test database.

I tried this commmand:

‌‌select dbms_metadata.get_ddl('VIEW','VIEW_NAME','VIEW_OWNER') from dual;

It generated a create script and I run it. But it didn't copy all of the dependencies, data types, etc.

How can I do this?


  • I usually run git checkout at the command prompt. If you are using SQLDeveloper, use the Cart feature. Aug 12, 2020 at 12:16

1 Answer 1


That would require selecting from dba_dependencies. Since your dependencies may have their own dependencies that query would probably need to be recursive.

Also, if any of the dependencies are in a different schema then you'll also need the grants to go with them which you can get by selecting from dba_tab_privs and dba_col_privs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.