From 92d4ebcb67cad6e0390e2fc93b836d2fb2b012b0 Mon Sep 17 00:00:00 2001 From: PriestJ Date: Fri, 1 Feb 2008 17:33:52 +0000 Subject: [PATCH] added function to test if a quotation document/file exists git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@3446 248e525c-4dfb-0310-94bc-949c084e9493 --- Modules/MIP_FILES.pck | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Modules/MIP_FILES.pck b/Modules/MIP_FILES.pck index 68395e4..edfc10e 100644 --- a/Modules/MIP_FILES.pck +++ b/Modules/MIP_FILES.pck @@ -5,6 +5,7 @@ create or replace package MIP_FILES is -- Purpose : Handle files for the webMIP system -- Public function and procedure declarations +function quote_file_exists(p_qute_id number) return boolean; function delete_file(p_id number) return boolean; function drawing_file_exists(p_drwg_code varchar2) return boolean; function update_file_association(p_uri in varchar2, @@ -53,6 +54,33 @@ create or replace package body MIP_FILES as delete wwv_flow_files where wwv_flow_files.name = l_uri; return true; end delete_file; + /* + FUNCTION quote_file_exists + - takes the quote id and searches for associated file in APEX Application + - Files, returns true if the file exists or false if it does not exist + %param p_qute_id - the quote id + */ + function quote_file_exists(p_qute_id number) return boolean is + l_file_exists number; + CURSOR c_file_exists(cp_qute_id number) IS + select 1 + from wwv_flow_files + where name=(select d.uri + from documents d, document_roles dr + where dr.qute_id = cp_qute_id and d.id = dr.docu_id); + begin + IF NOT c_file_exists%ISOPEN THEN + OPEN c_file_exists(p_qute_id); + END IF; + FETCH c_file_exists + INTO l_file_exists; + CLOSE c_file_exists; + if l_file_exists is not null and l_file_exists>0 then + return true; + else + return false; + end if; + end quote_file_exists; /* FUNCTION drawing_file_exists - takes the drawing code and searches for associated file in APEX Application