how to Run a wrapped package body in c# RRS feed

  • Question

  • i have a package header stored in .sql file and i can load this on oracle db from C# - by reading the contents into a File stream object and storing in a string object and executing the Oracle command. all this is fine.

    but my package body is wrapped in a plb file. and i have to load that into a database using c#. what is the sol for this??

    how to use OracleCommand object to execute the binary file on database. i believe ExecuteNonquery method expects a String. I cannot dump the contents of plb file
    (wrapped plsql source) to a string, right?? even if i dump the binary contents to a
    string object, will the OracleCommand can execute it correctly??

    if not, are there any methods over OracleCommand Object that can expect
    a binary stream ??

    need a quick help!!!

    thnx in adv
    • Edited by AppsMyself Monday, March 1, 2010 4:46 PM
    Saturday, February 27, 2010 1:49 PM

All replies

  • You can run PL/SQL, a stored procedure or a function from ADO.NET. It isn't possible to execute a binary file directly. I would suspect that you will need to run the wrapped PL/SQL from a stored procedure or function and run the stored procedure from ADO.NET.

    Paul ~~~~ Microsoft MVP (Visual Basic)
    Monday, March 1, 2010 1:57 PM
  • thank you Paul.

    i understand that from sql developer /sql plus , if i give as follows -

    @ <filename>

    execute the above, it works whether it is a wrapped/unwrapped plsql .

    but how to replicate the same in c# for a wrapped plsql??

    say the same .sql script file (that is not in wrapped format but has plsql header contents),

    iam able  to execute like this -

    create a file stream object. use it to get the contents of the .sql file in a string. and i pass this

    string to Oracle command. if this am able to execute. y not wrapped plsql source file ??

    somehow i cant prefer writing a procedure in plsql and calling from c#.. as my requirement is

    to execute the scripts from c#...

    Monday, March 1, 2010 4:42 PM