-
New to PL/SQL, Please Give examples
Hello PL/SQL Guru's,
I am new to programming, but I wanted to write a store procedure that:
Accepts an appID as input and use it to return the card number of any card(s) in an active state associated with the appID, if any from the database.
I want this to work with our software, java.
Could you please give me some examples of how to design this?
Thanks in advance for your help!
-
-
You want something like this. Although, you should add some error handling, like what do you return when you do not get any rows, or when you get more than one row. And I do not know your table name or column names. Try readiing PL/SQL Best Practices by Steven Feuerstein.
Code:
CREATE FUNCTION get_CardNumber (
p_appid IN cardtable.appid%TYPE )
RETURN cardtable.cardnumber%TYPE
AS
v_return cardtable.cardnumber%TYPE;
BEGIN
SELECT cardnumber
INTO v_return
FROM cardtable
WHERE appid = p_appid;
RETURN v_return;
END get_CardNumber;
/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|