Update with subselect with error ORA-00936

Dúvidas, dicas e truques de SQL, Select, Update, Delete, cláusulas, operações com joins, Funções em SQLs, etc
  

Poston Wed, 15 Aug 2012 10:32 am

Hello everybody, good night everyone!

I'm trying to accomplish the update below, but does not run and display the error ORA-00936, however if I run only the select does not mistake, I'm sending the query below. Thank you for your help.


UPDATE SET e2_datalib = se2010 ' 20120814 ', e2_usualib = ' Administrator ', e2_baixa = ' 20120814 ', e2_saldo = ' 0 ', e2_valliq = e2_valor, e2_hist = ' MSG ' WHERE (SELECT * FROM sed010 WHERE e2_saldo > se2010, 0 AND se2010. e2_filial = ' 01 ' AND se2010. d_e_l_e_t _ = '' AND e2_exig <> AND <> e2_naturez 'n ' e2_tipo ' AND 2603 NOT IN (' NDF ', ' ADV ') AND sed010. d_e_l_e_t _ = '' AND sed010. ed_filial = ' 01 ' AND e2_tipo <> ' PA ' AND e2_vencto < = ' 20111227 ' AND e2_naturez = ed_codigo) thank you, Márcio Souza
Marcio Souza
Location: RJ

Márcio Souza

Poston Wed, 15 Aug 2012 11:55 am

Brother, I can not run here.
See if it has the same effect:
Code: Select all
UPDATE se2010
   SET e2_datalib = '20120814',
       e2_usualib = 'Administrador',
       e2_baixa   = '20120814',
       e2_saldo   = '0',
       e2_valliq  = e2_valor,
       e2_hist    = 'MSG.'
WHERE
     AND e2_saldo > 0
     AND e2_exig <> 'N'
     AND e2_naturez <> '2603'
     AND e2_tipo NOT IN ('NDF', 'ADV')
     AND e2_tipo <> 'PA'
     AND e2_vencto <= '20111227'
     AND EXISTS (SELECT 1
                   FROM sed010 e1
                  WHERE e1.e2_filial = '01'
                    AND se2010.e2_naturez = e1.ed_codigo
                    AND e1.d_e_l_e_t_ = ' '
                    AND e1.d_e_l_e_t_ = ' '
                    AND e1.ed_filial = '01')
Trevisolli
Location: Araraquara - SP

Abraço,

Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP

Poston Wed, 15 Aug 2012 1:46 pm

Cheezburger network talks, presented the same problem, sinister.

Thank you huh!
Marcio Souza
Location: RJ

Márcio Souza

Poston Wed, 15 Aug 2012 2:58 pm

Desculpae, on the collar, I glued a wrong tab (had a AND more):
Code: Select all
UPDATE se2010
   SET e2_datalib = '20120814',
       e2_usualib = 'Administrador',
       e2_baixa   = '20120814',
       e2_saldo   = '0',
       e2_valliq  = e2_valor,
       e2_hist    = 'MSG.'
WHERE e2_saldo > 0
     AND e2_exig <> 'N'
     AND e2_naturez <> '2603'
     AND e2_tipo NOT IN ('NDF', 'ADV')
     AND e2_tipo <> 'PA'
     AND e2_vencto <= '20111227'
     AND EXISTS (SELECT 1
                   FROM sed010 e1
                  WHERE e1.e2_filial = '01'
                    AND se2010.e2_naturez = e1.ed_codigo
                    AND e1.d_e_l_e_t_ = ' '
                    AND e1.d_e_l_e_t_ = ' '
                    AND e1.ed_filial = '01')
Trevisolli
Location: Araraquara - SP

Abraço,

Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP


  • See also
    Replies
    Views
    Last Post


Return to SQL

Who is online

Users browsing this forum: No registered users and 2 guests