Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3976528
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:48:55+00:00 2026-05-20T04:48:55+00:00

Can any one tell what’s going wrong with my routine this is what I

  • 0

Can any one tell what’s going wrong with my routine this is what I have written

Routine DDL:

DELIMITER $$

CREATE DEFINER=`root`@`%` PROCEDURE `uspEmployeeBankDataUpdate`(_EmpID int,
                _PayeeName varchar(20),
                _BankRoutingNumber varchar(9),
                _BankTypeID varchar(5),
                _AccountType varchar(2),
                _BankAccount int,
      _Amount DOUBLE,
                _Comments varchar(50),
                _Address1 varchar(30),
                _Address2 varchar(30),
                _ZipCode DECIMAL(9,0),
                _City varchar(25),
                _StateName VARCHAR(30),
                _Country varchar(20),
      _BankAccountType varchar(30),
      _EndDate datetime)
BEGIN

declare p_ecount int;

declare _startdate Date;

set _startdate=(select date(startdate) from tblEmployeeBankData  where
           EmpId=_EmpId and
           EndDate='9999-12-31');


  set p_ecount=(select count(1) from tblEmployeeBankData where 

  PayeeName=_PayeeName and


   BankRoutingNumber=_BankRoutingNumber and

BankTypeID=_BankTypeID and
AccountType=_AccountType and
BankAccount=_BankAccount and
Amount=_Amount and 
Comments=_Comments and
Address1=_Address1 and 
Address2=_Address2 and 
ZipCode=_ZipCode and 
City=_City and
StateName=_StateName and 
Country=_Country and 
BankAccountType=_BankAccountType and 
EndDate='9999-12-31');

if  p_ecount=0 and _startdate<curdate() then        
    begin        
    update tblEmployeeBankData set EndDate=_EndDate
    where EmpID=_EmpID and EndDate="9999-12-31";       
   end;
   end if;

  END

This is my sample code of passing

  m_oCmd.Parameters.AddWithValue("_EmpID", EmpID);
            m_oCmd.Parameters.AddWithValue("_PayeeName", PayeeName);
            m_oCmd.Parameters.AddWithValue("_BankTypeID", BankTypeID);
            m_oCmd.Parameters.AddWithValue("_AccountType", AccountType);
            m_oCmd.Parameters.AddWithValue("_BankRoutingNumber", BankRoutingNumber);
            m_oCmd.Parameters.AddWithValue("_BankAccountType", BankAccountType);
            m_oCmd.Parameters.AddWithValue("_BankAccount", BankAccount);
            m_oCmd.Parameters.AddWithValue("_Amount", Amount);
            m_oCmd.Parameters.AddWithValue("_Comments", Comments);
            m_oCmd.Parameters.AddWithValue("_Address1", Address1);
            m_oCmd.Parameters.AddWithValue("_Address2", Address2);
            m_oCmd.Parameters.AddWithValue("_ZipCode", ZipCode);
            m_oCmd.Parameters.AddWithValue("_City", City);
            m_oCmd.Parameters.AddWithValue("_StateName", StateName);
            m_oCmd.Parameters.AddWithValue("_Country", Country);
            m_oCmd.Parameters.AddWithValue("_EndDate", EndDate);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T04:48:55+00:00Added an answer on May 20, 2026 at 4:48 am

    The error is here

    set _startdate=(select date(startdate) from tblEmployeeBankData  where
               EmpId=_EmpId and
               EndDate='9999-12-31');
    

    If the condition EmpId=_EmpId and EndDate='9999-12-31' results in more than one record, it fails. Use LIMIT and ORDER BY to choose one particular record (startdate), e.g.

    set _startdate=(select date(startdate) from tblEmployeeBankData  where
               EmpId=_EmpId and
               EndDate='9999-12-31'
               ORDER BY startdate DESC
               LIMIT 1);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can any one tell me if its possible to create a stored procedure in
Can any one tell me that why delay happen when I run this script
Can any one tell me that, Is is possible in wss to have our
Can any one tell me the meaning of this error , this is the
Can any one tell me how can this project be used for documentation purpose
Can any one tell me why I am getting this error ? [myClassName tableView:numberOfRowsInSection:]:
can any one tell me the best way to learn spring. i have sound
can any one tell me how to create a silver light application in VS2008
Can any one tell me how to implement load more button. I have a
Can any one tell me how to create multi line text box with increasing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.