cancel
Showing results for 
Search instead for 
Did you mean: 

Update error from RECURSIVE view_parts

ximen
Participant
0 Kudos
1,950
WITH RECURSIVE parts ( component, subcomponent, quantity ) AS
(
  SELECT CAST( NULL AS VARCHAR ),  -- CASTs must be used
         'bookcase',
         `enter code here`         -- to declare the
         CAST( 1   AS INT )        -- correct datatypes

   UNION ALL

  SELECT b.component,
         b.subcomponent,
         p.quantity * b.quantity
    FROM parts p
    JOIN bookcase b
      ON p.subcomponent = b.component
)
update updte_date 
   set subcomponent='newdate'
  FROM parts,update_date --error update
VolkerBarth
Contributor
0 Kudos

Hm, is that "mfkpie8-style" to leave the actual question as an exercise for the reader?

Accepted Solutions (0)

Answers (1)

Answers (1)

Breck_Carter
Participant

Please do not post garbage... please ask an actual question, with actual code, and an actual error message.

HOWEVER... you have a record on this forum of not even trying. In my opinion you should be banned for wasting everyone's time.

Could not execute statement.
Syntax error near 'CAST' on line 6
SQLCODE=-131, ODBC 3 State="42000"
Line 1, column 1

WITH RECURSIVE parts ( component, subcomponent, quantity ) AS
(
  SELECT CAST( NULL AS VARCHAR ),  -- CASTs must be used
         'bookcase',
         `enter code here`         -- to declare the
         CAST( 1   AS INT )        -- correct datatypes

   UNION ALL

  SELECT b.component,
         b.subcomponent,
         p.quantity * b.quantity
    FROM parts p
    JOIN bookcase b
      ON p.subcomponent = b.component
)
update updte_date 
   set subcomponent='newdate'
  FROM parts,update_date --error update
VolkerBarth
Contributor
0 Kudos

you have a record on this forum of not even trying

That's a different kind of problems with "recursion", apparently:)