Having before Were :: worse than compiled!

Este forum é dedicado a códigos errados que se encontram por aí, ou seja, coisas que não se deve fazer de jeito nenhum! Não coloque neste forum dúvidas! (apenas situações bizarras do nosso dia a dia :-)
Post Reply
User avatar
dr_gori
Moderador
Moderador
Posts: 5024
Joined: Mon, 03 May 2004 3:08 pm
Location: Portland, OR USA
Contact:
Thomas F. G

Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered

Personal

This I put to you evaluate the strange things that occur sometimes: a select with having before the WHERE !!!

In the example below, I am simulating the error in an Oracle 8.0.6 (100% bugged). The worst is that in version 8.1.7.4 This is also working :-(

Select all

SQL> SELECT * FROM V$VERSION; 
 
BANNER 
---------------------------------------------------------------- 
Oracle8 Release 8.0.6.0.0 - Production 
PL/SQL Release 8.0.6.0.0 - Production 
CORE Version 4.0.6.0.0 - Production 
TNS for HPUX: Version 8.0.6.0.0 - Production 
NLSRTL Version 3.3.3.0.0 - Production 
 
SQL>  
SQL>  
SQL> create or replace procedure thomas_loucura 
  2  is 
  3    cursor vcur is 
  4          select    me.codmerc 
  5          from      mercean Me, 
  6                    mercfil mf 
  7          having    max(flgbase)  =  'N'       ---  **** ABSURDO **** 
  8          where     me.codmerc    =  mf.codmerc 
  9          and       mf.codsit     <> 'E' 
 10          group     by me.codmerc; 
 11   
 12    vtemp number; 
 13  begin 
 14   
 15   
 16    open vcur; 
 17    fetch vcur into vtemp; 
 18    close vcur; 
 19   
 20  end; 
 21  / 
 
Procedure created 
 
SQL>  
SQL> EXEC THOMAS_LOUCURA; 
 
PL/SQL procedure successfully completed 
 
SQL> 
No frio explains ...
gokden
Rank: DBA Pleno
Rank: DBA Pleno
Posts: 264
Joined: Sun, 19 Aug 2007 8:18 pm
Location: Ribeirão Preto - SP
Lucas de Souza

OCA Developer
Analista de sistemas

ours is even expensive
in a muito sense this também ....

here in 10g it returns this error:

Select all

ORA-00933: SQL command not properly ended
User avatar
dr_gori
Moderador
Moderador
Posts: 5024
Joined: Mon, 03 May 2004 3:08 pm
Location: Portland, OR USA
Contact:
Thomas F. G

Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered

If I run the direct SQL, it gives the same error.
He only accepts if it is within a procedure or package ...: Shock:
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 11 guests