ORA-00 904 name COLUMN: invalid identifier

Hi experts, i have this subquery
...
CASE      
     (SELECT DISTINCT (cu.descripcioncargo)
      FROM inscripcion.reportemovimiento r,
                inscripcion.usuario u,
                inscripcion.cargousuario cu,
                inscripcion.distritojudicial dj
      WHERE r.obs IS NULL
               AND r.login = u.login
               AND cu.codcargo = u.codcargo
               AND dj.coddistritojudicial = u.coddistritojudicial
               AND r.login = t3.login)
 WHEN 'MP' THEN 'Ministerio Público del Distrito ' || dj.NOMBREDISTRITOJUDICIAL
 WHEN 'PJ' THEN 'Corte Superior de Justicia ' || dj.NOMBREDISTRITOJUDICIAL
 END
...

what can i do for use dj.NOMBREDISTRITOJUDICIAL
In this moment i have this error
ORA-00 904 "DJ". "NOMBREDISTRITOJUDICIAL": invalid identifier
enrique_aeoAsked:
Who is Participating?
 
awking00Commented:
In your where clause, you have a line that says "and r.login = t3.login" but, in your join (the from clause), you only reference tables with the aliases of r, u, cu, and dj. You need to include the table with the alias of t3.
0
 
ajexpertCommented:
I believe you have misspelled column name NOMBREDISTRITOJUDICIAL in  distritojudicial table
 
0
 
enrique_aeoAuthor Commented:
this is not the problem, it happens that this column is within the query that is in brackets and I want to use outside
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Naveen KumarProduction Manager / Application Support ManagerCommented:
give your complete query please.
0
 
enrique_aeoAuthor Commented:
at this time I'm home, I happened within 10 hours
0
 
Naveen KumarProduction Manager / Application Support ManagerCommented:
ok. unless complete query is there, nothing much can be commented.
0
 
JRCPrezCommented:
You are using the table alias "dj" in the subquery (the query enclosed in parentheses), but then you try to access the same table alias outside of that subquery - that appears to be the problem. But without seeing the entire query, not sure.
0
 
slightwv (䄆 Netminder) Commented:
>> it happens that this column is within the query that is in brackets and I want to use outside

As JRCPrez suggests and based on your own statement, you cannot do this.  It's a scope issue.  The column only exists within the scope of the subquery.  You cannot reference it outside that scope.

0
 
awking00Commented:
Try the attached.
query.txt
0
 
enrique_aeoAuthor Commented:
I attached the main quey
mainQUERY.txt
0
 
enrique_aeoAuthor Commented:
Please awking00: you can put your query to the main query
0
 
enrique_aeoAuthor Commented:
HI awking00: i puit your code buy ia have this error: ORA-00936: missing expression
I attached all query
queryMODIFY.txt
0
 
awking00Commented:
See attached.
comments.txt
0
 
enrique_aeoAuthor Commented:
i have the same error, view attached please
error01.jpg
error02.jpg
0
 
awking00Commented:
You need to include whatever table is aliased as t3 in the FROM clause.
0
 
enrique_aeoAuthor Commented:
please, give me the code, i do not understand very well... sorry
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.