Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Compatibilidade SQL x ORACLE
Message
From
27/05/2002 06:58:43
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Compatibilidade SQL x ORACLE
Miscellaneous
Thread ID:
00661619
Message ID:
00661619
Views:
64
Olá a *.*

Coloquei esta dúvida semana passada nos fóruns de ORACLE e SQL porém não obtive nenhuma resposta, vou postar aqui (em português), espero que alguém me ajude

Estou escrevendo uma instrução SQL para trabalhar com SQL SERVER e ORACLE

Quando eu seleciono os campos preciso utilizar a cláusula "CASE" do SQL SERVER, assim:
select Fieldx = CASE 
	           WHEN IT.UNIDADE=PRD.UNID1 THEN 1
                 WHEN IT.UNIDADE=PRD.UNID2 THEN PRD.FACONV
	         ELSE PRD.FACONV3
               END
 from ...
Utilizando ORACLE, a instrução é:
select Fieldx = (DECODE(IT.UNIDADE,
                        PRD.UNID1,1,
                        PRD.UNID2,PRD.FACONV
                        PRD.FACONV3 ))
from ...
Eu utilizei o DECODE para comparar se o com é igual a determinada expressão
Como posso utilizar (em ORACLE) as opções para maior, menor, diferente, etc.

Veja a instrução para SQL SERVER:
select fieldx = Case       
    when p.IncIcms = 0 then 0 	       
    when p.IncIcms <> 0 and t.UsoMens = 'A' then 200       
    when p.IncIcms <> 0 and t.UsoMens <> 'A' and AliqICMS = 0 then ?Estados.AliqIcms       
    when p.IncIcms <> 0 and t.UsoMens <> 'A' and AliqICMS <> 0 then AliqICMS    
end
from ...
Obrigado!
Reply
Map
View

Click here to load this message in the networking platform