2

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();

1 Answer 1

2

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.

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

1 Comment

Then put back the single quotes you had there originally. BTW: Does your table tn2 really have a column child with the value "level-1-1-767"?

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.