I've been struggling with this for a while.
I want to create 3 different stored procedures but i am not very sure about the syntax and how to execute them in Oracle database (version 11g)
My table contains these columns, this is the definition:
id NUMBER
amount VARCHAR2(30)
date VARCHAR2(30)
I want to create a procedure that allows me to fecth all the rows from a single table, this is what i did:
create or replace PROCEDURE GetAllRows(cursor_ OUT SYS_REFCURSOR) AS
BEGIN
OPEN cursor_ FOR
SELECT *
FROM My_Table
END GetAllRows;
Is it okay? How should i execute it?
Also , i'd like to INSERT some information to that table, so i created this another SP:
CREATE PROCEDURE insert_row(
id IN NUMBER,
amount IN VARCHAR,
date IN VARCHAR
)
IS
BEGIN
INSERT INTO My_table(id, amount, id) VALUES (id, amount, date);
END insert_row;
Is it okay? how should i execute it?
I'm kinda lost with Oracle databases.