0

is there a way to call a function in Oracle using a dynamic variable name? I am trying to call DBMS_LOB.COPY with dynamic column 1...10.

I can do this :

DBMS_LOB.COPY(dynamicColumn1 , l_clob, n_size_clob, 1,  clob_offset )

But I can't do

execute immediate  'select DBMS_LOB.COPY(dynamicColumn' || '1' ||  ', l_clob, n_size_clob, 1,  clob_offset ) from dual;`
4
  • what's the error you're getting? Exclude semicolon (;) at the end of your SQL statement Commented Jun 23, 2014 at 6:23
  • After removing semicolon as your suggested,it says ORA-00904: "DBMS_LOB"."COPY": invalid identifier Commented Jun 23, 2014 at 7:02
  • seems like you lack the privileges to access DBMS_LOB.copy Commented Jun 23, 2014 at 7:03
  • @Sathya, if that was the case, it should have thrown the same error when I try to use DBMS_LOB.COPY(dynamicColumn1 , l_clob, n_size_clob, 1, clob_offset ) Commented Jun 23, 2014 at 7:05

1 Answer 1

1

I wonder why people always try to use SELECT ... FROM dual.

DBMS_LOB.COPY is a procedure, thus you cannot used it in a SELECT statement. You can use only functions in a SELECT.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.