MySQL Forums
Forum List  »  Stored Procedures

Re: NAME_CONST slow down the query
Posted by: Larry Ng
Date: August 17, 2015 03:44PM

mysql> SHOW CREATE PROCEDURE udi_data.CkdSpn\G;
*************************** 1. row ***************************
Procedure: CkdSpn
sql_mode: STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITU
TION
Create Procedure: CREATE DEFINER=`ronc`@`10.128.%` PROCEDURE `CkdSpn`(InMemR
cn DECIMAL(11))
BEGIN
DECLARE Cnt INT DEFAULT 0;
DECLARE Cnt2 INT DEFAULT 0;
DECLARE MemRcn DECIMAL(11) DEFAULT 0;
DECLARE SpnRcn DECIMAL(11) DEFAULT 0;
SELECT COUNT(*) INTO Cnt FROM tblimx_tree_ref WHERE MemberID = InMemRcn;

IF
Cnt = 0
THEN
SELECT DSM_DST_RCN, DSM_SPN_RCN INTO MemRcn, SpnRcn FROM v_dsmfi
le WHERE DSM_DST_RCN = InMemRcn;
SELECT COUNT(*) INTO Cnt2 FROM tblimx_tree_ref WHERE SponsorID =
SpnRcn;
/*
If there are other mebers with the same Sponsor,create a child
else create a new node under the Sponsor
*/
IF
Cnt2 > 0
THEN
CALL CreateChild (MemRcn, SpnRcn);
ELSE
CALL CreateNode (MemRcn, SpnRcn);
END IF;
END IF;
END
character_set_client: utf8
collation_connection: utf8_general_ci
Database Collation: utf8_general_ci
1 row in set (0.05 sec)

Options: ReplyQuote


Subject
Views
Written By
Posted
4357
August 14, 2015 03:33PM
1793
August 16, 2015 12:35PM
1677
August 17, 2015 03:25PM
Re: NAME_CONST slow down the query
1764
August 17, 2015 03:44PM
1516
August 19, 2015 01:39PM


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.