Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

ora-00902 invalid data type

247890Jan 4 2009 — edited Jan 5 2009
Hello all -

I have a function that returns a ref cursor.

When I test this function using PL/SQL developer, it works just fine and returns ref cursor with a set of price values for a set of products.

However, when I test the same function from SQL*Plus, it errors out.

select get_price('0123','p1,p2,p3') from dual;

Error at line 1:
ORA-00902: invalid datatype

Could you please help me out. Thanks in advance.

Comments

662454
Result of my own research is, that utl_file.fcopy isn't meant for copying binary files as xls or pdf files are. Copied file's length had changed a bit which can be explained by fcopy putting CR+LF characters after each "line". Whatever line it finds in a binary file. Thus, it's not suitable for my needs.

The DBMS_FILE_TRANSFER package won't do either, because it requieres directory objects as source and destination. Because physical file structure provides a special folder for each file and its versions, I would have to dynamically (re-)create directory objects for each copy process. This could be done by dynamic DDL but can't be done because of the whole process being started by a trigger which doesn't allow the auto commit of DDL statements. Yes, I could wrap that in an autonomous transaction but, well, that seems to be no good practise. And more, the copy method of that package relies on a very specific file size in exact multiples of 512 bit (I didn't quite get the reason for that).

Seems, I will have to put all that files (which are more than 1000 an more than 2GB) in BLOBs. Wonder, what problems that will give to me...

Yet, any hints and opinions are still welcome.

Regards
Claus.
662454
Problem solved by using DBMS_SCHEDULER ablilities.

Claus.
Rnr-Oracle
To expand on what I assume the solution was (for reference).

The poster probably used the dbms_scheduler get_file and put_file functions which are new in 11g.

They allow files to be copied to/from the operating system as a particular user. The username and password of the operating system must be stored in the database as a credential object using dbms_scheduler.create_credential.

Hope someone finds this useful,
Ravi.
662454
Hi there

We are driving a 10g version, so I wasn't able using the get_file/put_file methods. No, I just created an executable type job and provided a rather lengthy string as job action.
This action string contains calling cmd.exe witch again calls copy.bat.
Like that:
"c:\winnt\system32\cmd.exe /q c:\copy.bat path\to\sourcefile path\to\destinationfile > nul"

No other parameters for cmd.exe should be provided, in contradiction to what other examples say. Copy.bat is a wrapper batch file for native copy command.

That's all.

Claus.
1 - 4
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Feb 2 2009
Added on Jan 4 2009
30 comments
8,049 views