ram
ram

Reputation: 57

using oracle db. getting in the following statements."ORA-00936: missing expression" , how to fix this?

hi i am using oracle db. getting in the following statements."ORA-00936: missing expression"

string sqlquery = ("select parent from tn2 where CONNECT BY PRIOR child=" + node);
        string connectionString = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.60.212.62)(PORT=1521)))(CONNECT_DATA=(SID=orcl)));User Id=apex_demo;Password=apex_demo;";
        OracleConnection con = new OracleConnection(connectionString);
        con.Open();
        OracleDataAdapter adapter = new OracleDataAdapter(sqlquery, con);
        adapter.Fill(objDT1);
        con.Close();

Upvotes: 2

Views: 717

Answers (1)

Daniel Hilgarth
Daniel Hilgarth

Reputation: 174467

Remove the semicolon at the end of the SQL statement. It is not allowed when executing SQL statements from .NET.
Also, the where is invalid here, because you don't provide a condition. The CONNECT BY PRIOR is no where condition but a construct on its own. See here for more info on how to use CONNECT BY PRIOR.

Upvotes: 2

Related Questions