I've got a particularly pressing issue; I have a suite of stored procs in MSSQL that don't directly translate to Oracle. I've made a good attempt, but I think that my paradigm isn't working the same in Oracle that it is in MSSQL - and it's a fundamental thing.
In MSSQL, I:
Create a temporary table (I don't know the structure at design time, only run-time - I create the temp table from another table) Insert records into the temporary table
THEN, Run a dynamically determined set of stored procedures (from data in the database) that refine the data (i.e. delete rows that don't meet the criteria) from the temporary table
THEN, Return the records from the temporary table.
That works alright in MSSQL (at the moment, until I can refine the entire layer). However, in oracle, we attempted the same thing. Since Oracle doesn't have the same temp table paradigm, I ended up creating a table and then dropping it at the end of the transaction. What I'd really like to do is figure out how to make this perform like it does in MSSQL.
I thought maybe I could use a cursor in the same way as the MSSQL temp table, but I can't see how to delete records from a cursor without deleting records from the database - at least, that's what I find every time I look up delete cursors.
EXAMPLES:
(MSSQL)
SELECT
objectid, typeid, field1, field2, field3, field4
INTO
#temptable
FROM
objecttable
EXEC FilterRecordsSuite #temptable
SELECT * FROM #temptable
(ORACLE)
BEGIN
EXECUTE IMMEDIATE
'CREATE TABLE mytemptable_<uniquevalue> AS
SELECT
objectid, typeid, field1, field2, field3, field4
FROM
objecttable
';
COMMIT;
FilterRecordsSuite mytemptable_<uniquevalue>
OPEN :some_ref_cursor FOR
'SELECT * FROM mytemptable_<uniquevalue>';
EXECUTE IMMEDIATE 'DROP TABLE mytemptable_<uniquevalue>'
This isn't my code, this is old and horrible. I'm just trying to make it work until I can refactor the whole thing into something intelligible. Unfortunately I have very little experience with Oracle and the immediate demands of keeping the application functional and even mildly performant outweigh my ability to refactor.
Any ideas?