MySQL Forums
Forum List  »  Newbie

Re: A problem with IFstatement.
Posted by: orderil orderil
Date: July 26, 2005 08:29AM

Ok. I got it.
I was trying to execute this script:


-- start of the script
-- adding access control data for the product root

SET @productRootId:=0;
SELECT (@productRootId:=TREE_NODE_ID) FROM DEF_TREE_NODE WHERE TREE_NODE_TYPE='product-root';

SET @hadProductTarget:=0;
SELECT @hadProductTarget:=1 FROM POL_TARGE WHERE DESCRIPTION='PROTOS Product root';

IF @hadProductTarget=0 THEN

INSERT INTO POL_TARGE (PERMISSION_TYPE, PERMISSION_NAME, DESCRIPTION, TARGET_TYPE)
VALUES ('com.foo.Classname', @productRootId, 'some description', 'Project');

INSERT INTO pol_polic (PRINC_ID, TARGE_ID)
VALUES (1, @@last_insert_id);

INSERT INTO pol_polac (POLIC_ID, ACTION_NAME)
VALUES (@@last_insert_id, 'pm_proj_admin');

END IF
-- end of the script


The logic I would like to implement is as follows:
If the DEF_TREE_NODE table has a record which record type is 'product-root' then execute 3 insertions commands.

Options: ReplyQuote


Subject
Written By
Posted
Re: A problem with IFstatement.
July 26, 2005 08:29AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.