set define '^' set verify off prompt ...wwv_flow_dml Rem NAME Rem wwv_flow_dml.sql Rem Rem MODIFIED (MM/DD/YYYY) Rem mhichwa 09/29/1999 - Created Rem mhichwa 12/30/1999 - Added g_varchar32767_text and g_clob_text Rem mhichwa 02/03/2000 - Added g_rowid global for inserts of multiple clobs Rem mhichwa 09/18/2000 - Added second key Rem mhichwa 03/06/2001 - Added grants and public syn Rem mhichwa 06/01/2001 - Added compute checksum Rem mhichwa 06/01/2001 - Added md5 checksum global var referenced by wwv_flow and plug Rem mhichwa 12/05/2001 - Added allowd actions Rem mhichwa 05/22/2003 - Added returning ID logic, bug 2965281 Rem sspadafo 06/09/2004 - Add parameter p_dml_fetch_mode to fetch_row (Bug 3674771) Rem jkallman 01/05/2007 - Add parameter p_lock to fetch_row and fetch_row_md5_checksum Rem mhichwa 11/28/2007 - Added p_runtime_where_clause Rem mhichwa 01/09/2008 - Added support for blobs Rem mhichwa 01/10/2008 - Added g_blob Rem mhichwa 01/11/2008 - Enhanced blob support Rem mhichwa 01/11/2008 - Added get_blob_file_src_and_pk Rem mhichwa 01/17/2008 - Added g_filename, g_charset Rem mhichwa 01/17/2008 - Added p_content_disposition Rem mhichwa 01/18/2008 - Added get_blob_download, get_pk1_from_blob_fmt_mask, get_pk2_from_blob_fmt_mask Rem mhichwa 01/22/2008 - Added function get_blob_rpt_link Rem mhichwa 01/23/2008 - Added procedure get_blob Rem mhichwa 01/24/2008 - Added comments Rem mhichwa 01/30/2008 - Added g_last_updated_date Rem mhichwa 02/19/2008 - Added g_validation_count to faciliate validations Rem sspadafo 02/03/2009 - Removed grant execute to public Rem sspadafo 02/04/2009 - Removed global g_column_values Rem jkallman 02/11/2009 - Moved serveral global variables to wwv_flow (after revoke of execute on wwv_flow_dml from public) create or replace package wwv_flow_dml is -- Copyright (c) Oracle Corporation 1999 - 2009. All Rights Reserved. -- -- DESCRIPTION -- APEX table access (DML) -- Page DML processes call this package. -- Fetch processes are typically called on page show. -- DML Process is typically called on page accept. -- Based on the request accept processing is directed to an insert, update, or delete procedure -- BLOB fetches are also performed -- g_checksum_text varchar2(32767) := null; g_md5_checksum varchar2(255) := null; g_download_text varchar2(255) := null; empty_vc_arr wwv_flow_global.vc_arr2; g_sqlerrm varchar2(5000) := null; g_support_file_item_type boolean := true; g_support_blob_col_type boolean := true; -------- -- FETCH -- -- Procedures called from DML Page Process Types -- procedure fetch_row ( p_table_owner in varchar2 default null, p_table_name in varchar2 default null, p_rowid in varchar2 default null, p_alt_rowid in varchar2 default 'ROWID', p_rowid2 in varchar2 default null, p_alt_rowid2 in varchar2 default null, p_compute_checksum in varchar2 default 'YES', p_dml_fetch_mode in varchar2 default null, p_lock in varchar2 default 'NO', p_runtime_where_clause in varchar2 default null ) ; function fetch_row_md5_checksum ( p_table_owner in varchar2 default null, p_table_name in varchar2 default null, p_rowid in varchar2 default null, p_alt_rowid in varchar2 default 'ROWID', p_rowid2 in varchar2 default null, p_alt_rowid2 in varchar2 default null, p_lock in varchar2 default 'NO') return varchar2 ; function get_column ( p_column_name in varchar2 default null) return varchar2 ; ------------------------- -- UPDATE, INSERT, DELETE -- -- Procedures called from DML Page Process Types -- procedure update_row ( p_table_owner in varchar2 default null, -- table owner, #OWNER# defaults to owner of application p_table_name in varchar2 default null, -- table name p_rowid in varchar2 default null, -- p_alt_rowid in varchar2 default 'ROWID', p_rowid2 in varchar2 default null, p_alt_rowid2 in varchar2 default null, p_runtime_where_clause in varchar2 default null) ; procedure insert_row ( p_table_owner in varchar2 default null, p_table_name in varchar2 default null, p_alt_rowid in varchar2 default null, p_alt_rowid2 in varchar2 default null, p_return_item1_name in varchar2 default null, p_return_item2_name in varchar2 default null) ; procedure delete_row ( p_table_owner in varchar2 default null, p_table_name in varchar2 default null, p_rowid in varchar2 default null, p_alt_rowid in varchar2 default 'ROWID', p_rowid2 in varchar2 default null, p_alt_rowid2 in varchar2 default null, p_runtime_where_clause in varchar2 default null) ; procedure process ( p_action in varchar2 default null, p_table_owner in varchar2 default null, p_table_name in varchar2 default null, p_rowid in varchar2 default null, p_alt_rowid in varchar2 default 'ROWID', p_rowid2 in varchar2 default null, p_alt_rowid2 in varchar2 default null, p_allowed_actions in varchar2 default 'IUD', p_return_item1_name in varchar2 default null, p_return_item2_name in varchar2 default null, p_runtime_where_clause in varchar2 default null) ; ------------------ -- BLOB Management -- procedure get_blob_file ( -- Fetches BLOB content, called from APEX form pages with items of type FILE -- Used to download BLOB from database to Browser -- NOT designed to be called by application logic -- p_sid in number, -- Session ID p_aid in number, -- Application ID p_pid in number, -- Page ID p_dml_proc_id in number, -- DML Page Process ID from APEX meta data p_bcol in number, -- Item ID from APEX meta data of BLOB column p_pk1 in varchar2, -- value of primary key column p_ck in varchar2, -- checksum to prevent url tampering p_pk2 in varchar2 default null, -- optional value of second primary key column p_mimetype in varchar2 default null, -- p_content_disposition in varchar2 default null, -- p_show_last_mod in varchar2 default 'Y') -- ; function get_blob_file_src ( -- Reference apex_util.get_blob_file_src for additional documentation -- -- Relies on an item with source that uses the following syntax -- DB_COLUMN:MIMETYPE_COLUMN:FILENAME_COLUMN:BLOB_LAST_UPDATED_COLUMN:CHARSET_COLUMN:DOWNLOAD_LINK_TEXT -- p_item_name in varchar2 default null, -- name of apex page item of type FILE p_v1 in varchar2 default null, -- value of primary key column p_v2 in varchar2 default null, -- optional value of optional secondary primary key column p_content_disposition in varchar2 default null) -- optional value of "inline" or "attachment" return varchar2 ; function get_blob_file_src_and_pk ( -- p_item_name in varchar2 default null, p_item_source in varchar2 default null, p_content_disposition in varchar2 default null) return varchar2 ; function get_blob_download ( -- format_mask = DOWNLOAD: