tags:

views:

7

answers:

0

I have a sql that will be use to add a node for nested set,this is my sql SELECT @myRight := rgt FROM nested_category WHERE name = 'TELEVISIONS';

UPDATE nested_category SET rgt = rgt + 2 WHERE rgt > @myRight; UPDATE nested_category SET lft = lft + 2 WHERE lft > @myRight;

INSERT INTO nested_category(name, lft, rgt) VALUES('GAME CONSOLES', @myRight + 1, @myRight + 2);

Normally i can put this in stored procedure, but create procedure is not supported in H2, it seems like the solution was to use java function with create alias. Can anyone please help me out here.