[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1484
  • Last Modified:

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
0
enrique_aeo
Asked:
enrique_aeo
  • 7
  • 4
  • 2
  • +3
1 Solution
 
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
 
Naveen KumarProduction Manager / Application Support ManagerCommented:
give your complete query please.
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
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
 
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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 7
  • 4
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now