Solved

Dynamic SQL statement Failed in C# - works fine in TOAD

Posted on 2010-09-12
6
384 Views
Last Modified: 2013-12-17
Hi Experts

i try to recompile invalid objects of Oracle from C#  application.
on TOAD and SQL+ it works fine
from C# i get error of  : ora-0900 sql  invalid statement\n

this is the script:  EXEC DBMS_DDL.alter_compile('PROCEDURE','DD20','RANGE1');

10x in advance
0
Comment
Question by:gudidi
6 Comments
 
LVL 74

Accepted Solution

by:
sdstuber earned 250 total points
ID: 33656685
don't use "exec"

that is a SQL*PLUS command that is replicated in Toad,  it's not really a sql or pl/sql command

just invoke the dbms_ddl procedure itself
0
 

Author Comment

by:gudidi
ID: 33656931
i still have the same error
0
 
LVL 20

Assisted Solution

by:flow01
flow01 earned 250 total points
ID: 33658098
change it to
BEGIN
   DBMS_DDL.alter_compile('PROCEDURE','DD20','RANGE1');
END;
to create a valid pl/sql block
0
The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

 
LVL 74

Expert Comment

by:sdstuber
ID: 33658394
how are you invoking this?

what are the c# command object parameters you are using?
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 33661371
I typically get that error when I forget and leave the semi-colon at the end of the command.

If this doesn't fix it, please post the code that you are using.
0
 

Author Comment

by:gudidi
ID: 33670222
the problem solved with:

ALTER PROCEDURE RANGE1 COMPILE

10x
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question