user2430219 user2430219 - 4 months ago 35
SQL Question

ORA-00907: missing right parenthesis in string query

I am not familiar with Oracle syntax, but I am getting a missing right parenthesis error when I am passing this string to an .Net Oracle Command and then it tries to fill the data adapter.

string cT = "SELECT 'PRODUCT' AS ItemType, 'x' || CAST(LPROD.QUANTITY AS VARCHAR2(50)), " +
"PNAME.NAME || ' (' || CAST((PRODS.\"SIZE\" AS VARCHAR2(50))) || ' ' || PRODS.MEASURE || ')' AS Name, " +
"PRODS.PRODUCT_ID as ProductSizeID, PRODS.UPC_CODE as BarCode FROM ORDERS ORDR, LI_PROD LPROD, PRODUCT_NAME PNAME, " +
"PRODUCT PRODS WHERE ORDR.INV_NUM = :Invoice_Num AND ORDR.ORDER_NUM = LPROD.ORDER_NUM " +
"AND LPROD.PRODUCT_ID = PRODS.PRODUCT_ID AND PRODS.PRODUCT_NAME_ID = PNAME.ID";


Can anyone spot the error that may be causing this? Thanks for your help.

Answer

Try:

cast(prods."SIZE" as varchar2(50))

Instead of:

cast((prods."SIZE" as varchar2(50)))