Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Missing expression

 
wadha alketbi
Ranch Hand
Posts: 53
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


In SQL Developer, I do all the queries in one package and in the Dao class, I call only the package
When I run the app. in the Eclipse, I Have this exception:

Caused by: java.sql.SQLSyntaxErrorException: ORA-00936: missing expression
ORA-06512: at "AU_MANAGEMENT.AUM_PACKAGE", line 480
ORA-06512: at line 1


FUNCTION SEARCH_DIR
    (
      P_D_NO       NUMBER,
      P_TITLE    VARCHAR2,
      P_STATUS   NUMBER,
      P_TYPE     NUMBER
    )
    RETURN T_DIR_SEARCH_RETURN
  IS
    V_QUERY_TEXT VARCHAR2(5000);
    V_DIR_SEARCH_RETURN T_DIR_SEARCH_RETURN;
  BEGIN
    V_QUERY_TEXT :=
    'SELECT   D_ID,                                                   
D_NO,                                                                                                       
D_TITLE,                                                                                                      
STATUS.S_DESCRIPTION STATUS_DESCRIPTION,                                                   
TYPE.T_DESCRIPTION TYPE_DESCRIPTION,                                                                                                     
(SELECT COUNT(*)  FROM DIR_FOLLOWUP DIR_FOLLOWUP WHERE DIR_FOLLOWUP.D_ID = DIR.D_ID),                                                                                           
USER.U_NAME USER_NAME,
FROM  DIRECTION DIRECTION,  STATUS STATUS, TYPE TYPE, USER USER                                                                                   
AND   DIRECTION.D_STATUS_CODE = STATUS.S_CODE                                           
AND   DIRECTION.D_TYPE_CODE =   TYPE.T_CODE                                            
AND   DIRECTION.D_CREATED_USER_ID = APPL_USER.U_SEQ';

V_QUERY_TEXT := V_QUERY_TEXT || ' ORDER BY D_NO ';
    OPEN V_DIR_SEARCH_RETURN FOR V_QUERY_TEXT;  >> This is line 480
    RETURN V_DIR_SEARCH_RETURN;
  END;


This is line 480:
OPEN V_DIR_SEARCH_RETURN FOR V_QUERY_TEXT;

can you help me please, if you have any idea.

Thank you in advance.
 
Dave Tolls
Ranch Hand
Posts: 2095
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does that query work if you copy and paste it into SQLDeveloper?
Include the ORDER BY.
 
wadha alketbi
Ranch Hand
Posts: 53
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so mutch for your response. I solve it, it was small comma befor "from"
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic