====== pears.BlobstoreDeleteExternal ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Original SQL =====
create function "pears"."BlobstoreDeleteExternal"(
/* Application Maintained Function / Procedure - DO NOT EDIT*/
in "xpath" char(250) )
returns integer
not deterministic
begin
declare "delcmd" char(10);
if "isnull"("xpath",'') <> '' then
if "right"("BlobstoreDbFolder"(),1) = '/' then -- sp_delete_file AVs if file does not exist so avoid
set "delcmd" = 'rm '
else
set "delcmd" = 'del '
end if;
return "xp_cmdshell"("delcmd"+"BlobstoreFullPath"("xpath"),'no_output') -- Will be 0 if the file was successfully deleted
else
return 0
end if
end