I need to write a store procedure which does the following:
Passes entire record as parameters ( one for each field).
Checks for the records existence.
If it exists then
update the record
Else
insert the record.
I'm new to this stuff and have been toiling with the syntax all day.
Hope someone can help.
My insert proc looks like this:
CREATE OR REPLACE PROCEDURE Addfund
(P_OLYID IN VARCHAR2,
P_WKN IN VARCHAR2,
P_ISIN IN VARCHAR2,
P_SECURITY_NAME IN VARCHAR2,
P_PROVIDER IN VARCHAR2,
P_DOMOCILE IN VARCHAR2,
P_CURRENCY IN VARCHAR2,
P_RISK IN VARCHAR2,
P_MIN_INVEST IN NUMBER,
P_COMMISSION IN FLOAT,
P_ALLOW_REINVEST IN VARCHAR2,
P_CUT_OFF_TIME IN DATE,
P_NAV IN NUMBER,
P_NAV_DATE IN DATE) AS
BEGIN
INSERT INTO TEST_FUND
VALUES(P_OLYID, P_WKN, P_ISIN,
P_SECURITY_NAME, P_PROVIDER,
P_DOMOCILE, P_CURRENCY,
P_RISK, P_MIN_INVEST,
P_COMMISSION, P_ALLOW_REINVEST,
P_CUT_OFF_TIME, P_NAV,
P_NAV_DATE);
END Addfund;
/
Bill Paton
william.paton@ubsw.com
Check out my website !
Passes entire record as parameters ( one for each field).
Checks for the records existence.
If it exists then
update the record
Else
insert the record.
I'm new to this stuff and have been toiling with the syntax all day.
Hope someone can help.
My insert proc looks like this:
CREATE OR REPLACE PROCEDURE Addfund
(P_OLYID IN VARCHAR2,
P_WKN IN VARCHAR2,
P_ISIN IN VARCHAR2,
P_SECURITY_NAME IN VARCHAR2,
P_PROVIDER IN VARCHAR2,
P_DOMOCILE IN VARCHAR2,
P_CURRENCY IN VARCHAR2,
P_RISK IN VARCHAR2,
P_MIN_INVEST IN NUMBER,
P_COMMISSION IN FLOAT,
P_ALLOW_REINVEST IN VARCHAR2,
P_CUT_OFF_TIME IN DATE,
P_NAV IN NUMBER,
P_NAV_DATE IN DATE) AS
BEGIN
INSERT INTO TEST_FUND
VALUES(P_OLYID, P_WKN, P_ISIN,
P_SECURITY_NAME, P_PROVIDER,
P_DOMOCILE, P_CURRENCY,
P_RISK, P_MIN_INVEST,
P_COMMISSION, P_ALLOW_REINVEST,
P_CUT_OFF_TIME, P_NAV,
P_NAV_DATE);
END Addfund;
/
Bill Paton
william.paton@ubsw.com
Check out my website !