ORA-02287: sequence number not allowed here
Bonjour tous le monde, je sais il est dimanche, il est tôt, :D
mais voilà, j'aimerai faire l'update suivant
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| UPDATE ph2_customer c
SET (customer_id, billing_customer) =
(
SELECT
customer_id.nextval,c.site_code
FROM
ph2_item i
WHERE
c.site_code = SUBSTR(i.old_sys_ref,(INSTR(i.old_sys_ref,':')-1))
)
WHERE
c.customer_id IS NULL; |
et l'erreur, ben comme dans le titre.
ORA-02287: sequence number not allowed here.
J'ai lu null part qu'on ne pouvait pas- ni qu'on pouvait d'ailleur - faire appelle à une séquence dans un update
bien à vous tous :ccool:
ORA-02287: sequence number not allowed here.
J'ai trouvé un debut de réponse ici:
http://download-west.oracle.com/docs...elements6a.htm
Qui dit:
Restrictions on Sequence Values
You cannot use CURRVAL and NEXTVAL in the following constructs:
* A subquery in a DELETE, SELECT, or UPDATE statement.
Alors j'ai coupé mon update en deux:
Code:
1 2 3 4
| UPDATE ph2_customer
SET customer_id = customer_id.NEXTVAL
WHERE
customer_id IS NULL; |
La même chose pour la column billing_customer.
Si quelqu'un à plus d'info ou une façon plus élégante....
Bon WE à tous:ccool: