Answer to Question #257736 in Databases | SQL | Oracle | MS Access for dee

Question #257736

Write a statement to create a stored procedure named Find_Contact based on the Contacts table in question 1 A, which does the following:Accepts an input parameter named @FindMobile that has the data type varchar. IF MobileNo exists: Print the message “Mobile No for:” concatenated with the input parameter. IF MobileNo do not exists: Print the message “Do Not Exist” concatenated with the input parameter. Executes a SELECT statement on the table Contacts, passing the input parameter as part of the WHERE clause. Return the contact details that match the input parameter value.


1
Expert's answer
2021-10-27T18:50:54-0400
CREATE PROCEDURE Find_Contact @FindMobile nvarchar(30)
AS
SELECT COUNT(*) @i INTO FROM Contacts WHERE phone_number = @FindMobile
IF @i>=1 THEN
PRINT("Mobile No for" + @FindMobile)
ELSE
PRINT("Do Not Exist")
GO;

Executing the procedure Find_Contact:
EXEC Find_Contact @FindMobile = 12234566;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS