Subscribe

RSS Feed (xml)

Powered By

Skin Design:
Free Blogger Skins

Powered by Blogger

oracle search

Wednesday, August 6, 2008

Frameworkia ....oracle

We thought long and hard about possible titles for this new PL/SQL development standard proposed on OTN, but we couldn't improve on the one it came with.

I want share a new IDEA to create a new standard PL/SQL developing:



Function ( Standard Buffer) return number
variable Number;
variable1 Varchar2;
begin
variable := get from Standard Buffer;
variable1 := get from Standard Buffer;

{ make your business }

put in standard buffer your results
end;

Give me feedback if you are interested at the new STANDARD called "FRAMEWORKIA".

A lot possibilities are ready.

Do you see the genius of it?

Er, no.

Sensing that there were people who still needed convincing, user601181 posted some sample code developed using the new Frameworkia:

CREATE OR REPLACE FUNCTION iacore
( eobufferia IN OUT typeeodata )
RETURN NUMBER
IS
CURSOR cur_getroutingcondition
( idc_workflow IN VARCHAR2
, idc_operation_node IN VARCHAR2 ) IS
SELECT *
FROM wf_condition
WHERE id_workflow = idc_workflow
AND id_operation_node = idc_operation_node;

rec_getroutingcondition cur_getroutingcondition%ROWTYPE;

CURSOR cur_dobufferiaassign
( idc_workflow IN VARCHAR2
, idc_operation_node IN VARCHAR2 ) IS
SELECT *
FROM wf_assignement
WHERE id_workflow = idc_workflow
AND id_operation_node = idc_operation_node;

rec_dobufferiaassign cur_dobufferiaassign%ROWTYPE;

next_node NUMBER;
next_node_ck NUMBER;
stop_node NUMBER;
operation VARCHAR2(256);
operation_call VARCHAR2(256);
type_node VARCHAR2(32);
workflow VARCHAR2(32);
line VARCHAR2(256);
status_wf_v VARCHAR2(3);
pid_chain_node NUMBER;
ia_tid VARCHAR2(64);
ia_tid_micro VARCHAR2(64);
ret_code_default NUMBER;
ret_code NUMBER;
retval1 NUMBER;
statementexc VARCHAR2(256);
schema_function VARCHAR2(32);
package_function VARCHAR2(32);
dblink_function VARCHAR2(32);
first_node_flag VARCHAR2(2) := 'NO';
id_debug_source NUMBER;
mapin_keyp VARCHAR2(1024);

headerbufferia typebufferia;
assignbufferia typebufferia;
checkbufferia typebufferia;

rec_wfnode wf_node%ROWTYPE;
rec_wffunctionsourcecode wf_function_source_code%ROWTYPE;
rec_wflogger wf_logger%ROWTYPE;
rec_wfbusiness wf_business%ROWTYPE;
rec_wffieldmapping wf_fieldmapping%ROWTYPE;
BEGIN
headerbufferia := eobufferia(1);

workflow := frameworkia.getvalue(headerbufferia,'ID_WORKFLOW');

---- DETERMINO QUALE NODO INVOCARE
pid_chain_node := frameworkia.getvalue(headerbufferia,'WF_NODE_ID');

----- SE IL NODO E' NULL ALLORA E' IL PRIMO NODO
IF pid_chain_node IS NULL
THEN
-------DETERMINO HANDLER E FILENAME PER IL LOGGER
SELECT *
INTO rec_wflogger
FROM wf_logger
WHERE id_workflow = workflow;
-- rec_WfLogger.ID_WORKFLOW
-- rec_WfLogger.ID_DEBUG_LEVEL
-- rec_WfLogger.ID_DIRHANDLER
-- rec_WfLogger.ID_FILENAME

--------INSERISCO NELL'HEADER
frameworkia.setvalue
( headerbufferia
, 'ID_DEBUG_WF'
, rec_wflogger.id_debug_level );

frameworkia.setvalue
( headerbufferia
, 'ID_DIRHANDLER'
, rec_wflogger.id_dirhandler );

frameworkia.setvalue
( headerbufferia
, 'ID_FILENAME'
, rec_wflogger.id_filename );

frameworkia.setvalue
( headerbufferia
, 'CHARACTER_EVIDENCE'
, '§§§§§§§§§§§§§§§§§§§§' );

-------DETERMINO L'ID NODE
SELECT wf_node_id
INTO pid_chain_node
FROM wf_node
WHERE id_workflow = workflow
AND wf_first_node = 'YES';

SELECT *
INTO rec_wfnode
FROM wf_node
WHERE id_workflow = workflow
AND wf_first_node = 'YES';

frameworkia.setvalue
( headerbufferia
, 'WF_NODE_ID'
, rec_wfnode.wf_node_id );

SELECT b.status
INTO status_wf_v
FROM wf_node a
, wf_name b
WHERE a.id_workflow = workflow
AND a.wf_node_id = rec_wfnode.wf_node_id
AND a.id_workflow = b.id_workflow;

IF status_wf_v = 'OFF'
THEN
RETURN -1;
END IF;

ia_tid := frameworkia.getvalue(headerbufferia,'IA_TID');
ret_code_default := 0;
ret_code := 0;

frameworkia.setvalue
( headerbufferia
, 'RET_CODE_DEFAULT'
, ret_code_default );

frameworkia.setvalue
( headerbufferia
, 'RET_CODE'
, ret_code);

IF ia_tid IS NULL
THEN
ia_tid := 'TIA' || dbms_random.STRING('U',1 * 1 + 6) ||
TO_CHAR(SYSTIMESTAMP,'YYYYMMDDHH24MISSFF6');

frameworkia.setvalue
( headerbufferia
, 'IA_TID'
, ia_tid );
END IF;

That's just the first hundred lines, and I've formatted it. The complete iacore function was well over 600 lines long.

I for one welcome the new standard.

No comments: