473,402 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

How to pass varchar parameter in stored procedure?

45
Hi all,

After a long time i am back with a new problem. Right now I am having a problem with stored procedure.
I am using stored procedure with PHP/MYSQL. And evry time I am changing the condition of query in stored procedure. when I am passing numeric value then its working fine but when I am passing varchar or text in parameter then it ia not working. While I have declare variable as VARCHAR(255).
Here is SP query...

Expand|Select|Wrap|Line Numbers
  1. CREATE PROCEDURE `testproc4`(IN `loc_name` VARCHAR(255), IN `property_country1` INT, IN `begin_beach_id` INT, IN `beach_id` INT, IN `lpi` INT, IN `lti` INT, OUT `prop_count` INT)
  2.     LANGUAGE SQL
  3.     NOT DETERMINISTIC
  4.     READS SQL DATA
  5.     SQL SECURITY INVOKER
  6.     COMMENT ''
  7. BEGIN 
  8.  
  9. IF property_country1 = "" THEN
  10. SELECT COUNT(pl.`property_id`) AS property_id INTO prop_count
  11. FROM `tbl_belt_propertylocation` AS pl
  12. JOIN `tbl_belt_propertydescription` AS pd ON (pl.property_id=pd.property_id)
  13. JOIN `tbl_belt_propertyfeatures` AS pf ON (pl.property_id=pf.property_id)
  14. WHERE `property_isdeleted` = 0 AND `property_beachdistance` > begin_beach_id AND `property_beachdistance`<= beach_id AND property_isdeleted=0 AND property_active=1; 
  15. ELSE
  16.  
  17. SELECT COUNT(pl.`property_id`) AS property_id INTO prop_count
  18. FROM `tbl_belt_propertylocation` AS pl
  19. JOIN `tbl_belt_propertydescription` AS pd ON (pl.property_id=pd.property_id)
  20. JOIN `tbl_belt_propertyfeatures` AS pf ON (pl.property_id=pf.property_id)
  21. JOIN `tbl_belt_location` AS country ON pl.property_country=country.id
  22. WHERE loc_name = property_country1 AND `property_beachdistance` > begin_beach_id AND `property_beachdistance`<= beach_id AND country.location_parent_id = lpi AND country.location_type_id = lti AND property_isdeleted=0 AND property_active=1; 
  23. END IF; 
  24. END
  25.  
Please help me out.

Thanks in advance
Sep 14 '10 #1
0 1624

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: VictorCorey | last post by:
Is it possible to use a multi-parameter query in .NET Here's the method Public Function SearchCatalog(ByVal searchString As String, ByVal allWords As String) As OleDbDataReade ' Create the...
2
by: SwatSoftwareDev | last post by:
Hi All, I want to use XML technologies with SQL Server 2000 for sending master details data from Application to SQL Server. I'm using xmldocument class for writing data in the form of attribute...
3
by: Joseph Lu | last post by:
Hi, all I have a stored procedure created in SQL Server like the following lines. // stored proceudre code starts here CREATE PROCEDURE sp_insertdata @strdata varchar(250) , @rsult BIT...
3
by: nitinp | last post by:
I want to bind GridView with sqlDataSource like following sqlDataSource1.SelectCommand = "GET_TRACKING_INFO"; sqlDataSource1.SelectCommandType = SqlDataSourceCommandType.StoredProcedure; ...
1
by: karups | last post by:
Hi, I've got listbox in my .aspx page where the users can make multiple selection. So, Users can select 7 items in listbox, I have to take value from items and pass it to stored procedure to...
2
by: rn5a | last post by:
How do I pass a NULL value to a field while inserting records in a SQL Server 2005 DB table using a stored procedure? I tried the following but it inserts an empty string & not a NULL value: ...
0
by: arunavlp | last post by:
hi, I am new to .net , i am using VB.Net (Web form). I dont know how to pass parameters to stored function. Regards, Arun.S
4
by: barmatt80 | last post by:
I am stumped on the error reporting with sql server. I was told i need to return @SQLCode(code showing if successful or not) and @ErrMsg(and the message returned). I am clueless on this. I...
2
by: gopi2ks | last post by:
I have one stored procedure like sp_insertEmployee Employee Table Fileds Eno int pk, ename varchar(100), designation varchar In stored Procedure After inserting the ename and...
3
by: gopi2ks | last post by:
Dear All, I have one stored procedure like sp_insertEmployee Employee Table Fileds Eno int pk, ename varchar(100), designation varchar
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.