Ask Your Question
0

Running a query with parameters and conditions using macro on form.

asked 2019-07-15 07:20:59 +0200

LO_user1 gravatar image

Hi Sir! Further to my previous question where I used a simple insert query with parameters to insert a record in a table taking values from other table. This time my query also have a condition. First it have to check weather the value IS NOT NULL then will insert record like this. This is a mysql procedure; DELIMITER // CREATE PROCEDURE InsertBfee(IN sid INT) BEGIN DECLARE bfee INT; SELECT Bus_Fee INTO bfee FROM Fee_Def WHERE STUDENT_ID = sid; IF bfee IS NOT NULL THEN INSERT INTO Fee_Trans(Fee_Type,Month,Stud_IDfk,Fee_Amount) VALUES ('BUS','May', sid,bfee); END IF; END // DELIMITER ; This procedure working perfectly if CALL it from macro on Base. Now I am trying to use it in HQLSDB database in query. Can you please guide me in reference to last question's macro code. How to write query for this above procedure and what change needed in macro code. Thank you very much.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2019-07-16 13:30:46 +0200

LO_user1 gravatar image

The mysql procedure can be rewrite in following simple SQL statement; image description

As the parameter is used once so it will be write once in macro code as it is discussed in referred question (previous question).

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-07-15 07:20:59 +0200

Seen: 27 times

Last updated: Jul 16