How to access IFS document contents in PL/SQL procedure ?
I am interested in using IFS as a way to load documents
(PDF, HTML, RFT, text...) in an Oracle database table, and
then access the table via a regular application Server.
I understand that the right way to do this is via a Java API
mapped on top of IFS.
But we already have a fairly sophisticated web application using
Java and PL/SQL procedures so that I would ideally need
to write a PL/SQL procedure such as :
function get_document (ifs_file_name in varchar, ifs_file_path in varchar) return clob
For this I need to outline how to query the IFS schema using SQL.
Any idea which table to query ?
Have a nice day
Many thanks to Chris Schneider : it works. Withing a few hours
I was able to make a servlet with a file name as a parameter which sends back
the file contents (in our case its a PDF file).
Here is a sample servlet which uses this access scheme :
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
public class TestIFS extends HttpServlet
* Handle the GET and HEAD methods by building a simple web page.
* HEAD is just like GET, except that the server returns only the
* headers (including content length) not the body we write.
public void doGet (HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
//PrintWriter out;
String title = "Test d'acchs IFS";
// set content type and other response header fields first
response.setContentType("application/pdf");
// then write the data of the response
ServletOutputStream outbin = response.getOutputStream();
String theQuery=
"SELECT "+
" odm_publicobject.name object_name"+
", odmm_contentstore.id content_id"+
", odm_format.mimetype"+
", odmm_contentstore.globalindexedblob "+
"FROM odm_publicobject"+
", odm_document"+
", odm_contentobject"+
", odmm_contentstore"+
", odm_format "+
"WHERE odm_publicobject.id = odm_document.id "+
"AND odm_document.contentobject = odm_contentobject.id "+
"AND odm_contentobject.content = odmm_contentstore.id "+
"AND odm_contentobject.format = odm_format.id "+
"AND odm_publicobject.name = ";
theQuery += "'" + request.getParameter("fic") + "'";
try {
System.out.println("TestIFS debut");
DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
Connection conn = DriverManager.getConnection ("jdbc:oracle:oci8:@LXP9","ifssys","ifssys");
Statement stmt = conn.createStatement ();
ResultSet rset = stmt.executeQuery (theQuery);
while (rset.next ()) {
byte b[] = new byte[10000000];
b = rset.getBlob(4).getBytes (1,10000000);
outbin.write (b);
rset.close();
System.out.println("TestIFS fin");
catch (Exception e) {
(beware mime type is forced to PDF, and file size max 10Mb)
Similar Messages
-
How to access iCloud documents on your mac.
I struggled with this for days and finally found a simple solution.
Here's one way:
http://www.youtube.com/watch?v=YrmZbTZwoeA&feature=player_embedded
Here's another. Thanks to http://osxdaily.com/2012/08/09/how-to-access-icloud-documents-from-the-mac-os-x- finder/
Getting Easy Access to iCloud Documents from the Mac Finder
Placing the Mobile Documents folder in the Finder window sidebar allows for quick access to files in the cloud:
From the Finder, hit Command+Shift+G to bring up the Go To Folder window, and enter the path to the user Library folder found at ~/Library/
Locate the directory titled “Mobile Documents” and drag that folder into the Finder window sidebar, or make an alias, this allows for easy access
If you poke around the “Mobile Documents” directory you’ll find another series of folders, some are named nonsensically based on GUIDs as this folder is not intended for general user access, but each one is in accordance to an application that stores documents in iCloud. Apps including Notes, TextEdit, Reminders, Mail, Keynote, and any other Mac app with iCloud support will be included.Making changes to a document that syncs with an iOS device will reflect in the appropriate app from iOS. Likewise, for any documents stored in iCloud the changes made to the folder will reflect on other Macs. Versions does not work here, so be careful with changes you make.One thing you may notice is that Camera Roll pictures are not stored in here, but there is a similar way to access the iOS Photo Stream from Mac OS X too if you use that feature on an iPhone or iPad.Heads up to MacWorld for the recent tip reminderhidden files in Finder
terminal copy&paste:
defaults write com.apple.finder AppleShowAllFiles TRUE ;killall Finder
defaults write com.apple.finder AppleShowAllFiles FALSE ;killall Finder
if it is just the user library you are looking to change:
chflags nohidden ~/Library -
How to access the Document Options dialog box to select display properties?
How to access the Document Options dialog box to select display properties (e.g. smartcut ) for a selected document to
be viewed in the Workspace.
regardsPreferences --> General --> Reset all warnings.
Mylenium -
How to pass Unix environment variable to a SQL procedure or SQL * Plus
Can any body suggest me how to ,
How to pass Unix environment variable to a SQL procedure or SQL * Plus file..
I am trying to invoke a SQL Procedure from Unix
by passing the value of a Unix environment variable.
Is it possible..?
Thanks in advance.
Regards,
Srinivas JaltaruWithin your shell script you can use what is known as a "here document" which is basically a way of wrapping a call to Oracle. The following call to Oracle loops and writes rows to files with numerically increasing file names. Two unix shell variables are used, one in a select statement and one in a spool command :
<pre>
#!/bin/bash
export ORACLE_SID=DEV05
FILENO=1007351
while [ ${FILENO} -le 1008400 ]
do
FILENAME=farm_${FILENO}.txt
DUMMY=`sqlplus -s user20/user20 <<SQLSTOP
set lines 73
set pages 0
set head off
set termout off
set echo off
set feedback off
select rpad(searchx, 8)
from blastx@PRODUCTION
where searchx = ${FILENO} ### here's a shell variable
spool /export/home/user20/sql/psiblast/BACKUP2_D/${FILENAME} ### here's a shell variable
spool off
SQLSTOP`
FILENO=`expr ${FILENO} + 1`
done
exit 0
</pre> -
How to send nested object collection to PL/SQL Procedure as an Input param
How to send nested object collection to PL/SQL Procedure as an Input parameter.
The scenario is there is a parent mapping object containing a collection(java.sql.Array) of child objects.
I need to send the parent object collection to PL/SQL procedure as a input parameter.
public class parent{
String attr1;
String attr2;
Child[] attr3;
public class Child{
String attr1;
SubChild[] attr2;
public class SubChild{
String attr1;
Urgent!!!
Edited by: javiost on Apr 30, 2008 2:09 AMjaviost wrote:
How to send nested object collection to PL/SQL Procedure as an Input parameter.There are a few ways to do this, all of which likely depend on the particular database you're using.
Urgent!!!Not to me... -
Accessing KM document content in Portal Code.
Hi friends,
I have a requirement to access Document stored in Knowlwdge management , while modifying one of the par files. But I have no idea how to access it in my code.
Please suggest some solution.
Regards,
ViditHello Vidit,
here is a small piece of java code which shows how to get the content of an document in KM:
//Get resource RID
RID rid = RID.getRID("path to dokument"); //For example /documents/example.doc
IResource res = null;
try {
IResourceFactory rfac = ResourceFactory.getInstance();
res = (IResource) rfac.getResource(rid,rfac.getServiceContext("ice_service"));
} catch (ResourceException re) {
String sre = re.getLocalizedMessage();
// Your error handling
BufferedInputStream stream = new BufferedInputStream(res.getContent().getInputStream(), 1024);
BufferedReader br = new BufferedReader(new InputStreamReader(stream,"windows-1251"));
Hope it helps, regards.
mz -
How to access KM documents from detailed navigation tree area in EP???
Hello Gurus,
I want to simulate the portal navigation. I want to show a page also with a detailed navigation tree with links to several KM documents on left frame and a content area for such content files on right frame.
I have decided to modify standard par file "com.sap.portal.navigation.lightdetailednavigationtree" and I tried to modify JSP to show dinamically several links to KM documents applying logic based on webdynpro tutorial "Using Knowledge Management funcionality in Web Dynpro applications". But a runtime error occurs. I don´t know if I must add sharing references in portalapp.xml for using such classes and also I don´t know the way to do it.
It would be really grateful if somebody could guide me through this issue or give me another more proper solution.
Thanks in advance.
Best Regards.
RosaHi javier,
If u want to access KM documents in some different format then ur default KM navigation Iview.
Then please have a look at this blog. It will really help you:
Launching WebDynpro from Universal Worklist
I hope it helps.
Please revert back in case of further issues.
Regards,
Sumit -
How to access / configure Web Content Management in NetWeaver
Hi,
I am using SAP EP6.0 and KM is running there. I want to know that how can I access the Web Content Manager of NetWeaver. What configuration is required to access WCM? Any pointer will help me.
Thanks in advance,
ManishHi,
Suppose you have two sites like this: "/sites/SI/SiteA" and “/sites/SI/SiteB”, then you can retrieve the ClientContext object and the List object like this:
var context = new SP.ClientContext("/SiteA");
var list = clientContext.get_web().get_lists().getByTitle('ListA');
Best regards
Patrick Liang
TechNet Community Support -
How to access Accordion section content data?
Hi Experts,
I have a accordion UI with four sections and each section has table as its content.
I want to know how to access table data present in the section ?Hi
would you be able to share some code so that we can help you?
Thanks
-D -
I have iCloud but I don't know how to access my documents from my iPad on my Macbook Pro.
I have Mac OS X Lion 10.7.3. I have read some things as to how to access files from iCloud in iTunes; but this didn't work or maybe I am not doing it correctly. i just started a doument on my ipad and I want to know how to access it now on my MacBook Pro. Help!
Go to www.icloud.com with Safari on the Mac. You will have to enter your username and password. iCloud will open to your account and there will be an iWorks icon that you can click on. Then you can click on Pages, Numbers or Keynote at the top. All of your documents should be in there. You can click on a document to download it. Follow the prompts if it asks what format you want.
As far as I know - only the iWorks applications currently work with this feature. -
Hi,
Can someone please provide more information on how to use the Fiori Content directly on HANA?!
Is there any Delivery unit which bundles the Fiori content, importing and deploying of which allows to create a Fiori App?! If no,
Then could you please provide the guidelines for adding ABAP front end server on HANA to run the UI part?!
And for the latter case, will the requirement of the UI be rendered by ABAP front end server with the XSODATA service provided by XS layer and the business logic computation taken care by Indexserver?!
Thanks a lot in advance,
PoornaHi Poorna,
Please look at Installation of SAP Smart Business Products on SAP HANA Server - SAP Fiori for SAP Business Suite - SAP Library.
Regards, Masa
SAP Customer Experience Group - CEG -
Moved to US - how to access Swedish iTunes content?
Hi,
I recently moved to US and changed the settings in iTunes so it turned into an american account, instead of previously, Swedish. Just realized that I can't watched movies bought on my Swedish account on apple TV now (just installed it).
QUESTION: Can I transfer Swedish content into the American account? Or can I only access the Swedish content if I have two separate iTunes accounts and switch between them?
Thanks in advance!Type "move itunes library" into the google search bar
-
How to call shell script from a pl/sql procedure
Hi all,
I am little bit new to plsql programming, i have a small problem as follows
I have to call a shell script from a pl/sql procedure ..
Please suggest me some methods in oracle 10g, which i could make use of to achieve my goal. also please tell me what are the constraints for those methods if any.
I already came across dbms_scheduler, but i have got a problem and its nor executing properly its exiting giving 255 error or saying that permission problem, but i have already given full access to my shell scripts.
Thanks in advance
Best Regards
SatyaHi,
Read this thread, perhaps is there your response :
Host...
Nicolas. -
How do I delete cascade with a PL/SQL procedure?
This script will create a PL/SQL procedure that deletes cascade. This is a post to contribute to the Oracle community. Take the code as is and test it before you use it in production. Make sure this is what you want.
Procedure Delete Cascade (prc_delete_cascade)
Description
=============
The principle is very simple. The procedure uses a table called TO_BE_DELETED to keep a list of records to be deleted. This
table keeps the table name and the rowid of those records that need to be deleted. The procedure also uses a function called
DELETE_BOTT_ROW which takes one record of the table and tries to delete it. If the deletion fails with a foreign key constraint
violation, the function parses the SQL error message (SQLERRM) to get the name of the constraint. With the name of the constraint,
the function finds the name of the child table, all the child records that have references to the parent table primary or unique key,
and the parent key primary or unique key column name. Once the child records of the failed delete are identified, the function takes their table name and rowids
and records them into the TO_BE_DELETED table by inserting records of their table name and their rowids. Al the records inserted also contain the level (which
is 1 for the original records, 2 for child records, 3 for granchild records, etc.) and the sequence number of the order in wich they
are recorded. This way, when the function picks up a record to be deleted, it takes the one with the highest level and the highest
inserted sequence, or the "bottom" record. Once all the child records of the failed delete are appended to the TO_BE_DELETED table, it calls itself
recursevely, and the function takes the record at the "bottom" of the table and tries to delete it. If it succeeds, it calls
itself recursevely to delete the next record. If it fails, it goes and finds the child records as described before and once they are
inserted into the TO_BE_DELETED table, it calls itself again recursevely to try to delete again the "bottom" record. All records
that are successfully deleted are flagged as deleted usig the flag_del column so they are not pickt up again. Once all the (parent,
child, grandchild, etc.) records are deleted, the procedure ends without commiting, giving the option to the user to commit or
rollback deletions. The table TO_BE_DELETED is, at the end of the procedure, a list of all the records that were deleted, including their table names
and the order in with they were deleted. The user then can review its content and decide to commit or rollback.
Restrictions
============
1. Single tables only. The procedure only takes one table name and a WHERE clause to identified the records to be deleted.
2. Single columns only. Ther procedure only works with single-column primary, unique and foreign key constraints.
3. Single schema only.
4. Unpredictable results with circular references.
drop table to_be_deleted purge;
create table to_be_deleted
(tname varchar2(30) -- table name
,rid rowid -- rowid
,lvl number -- level: 1=parent, 2=child, 3=grandchild, etc.
,seq_ins number -- sequence order of record inserted
,flg_del char -- flag deleted: Y=record deleted
,seq_del number -- global order of record deletion
set serveroutput on size 1000000
create or replace procedure prc_delete_cascade
(p_tname varchar2 -- table name
,p_where varchar2 -- where clause identifying records to be cascade deleted
is
dummy char;
v_sqlcode number;
v_sqlerrm varchar2(32767);
v_param_val integer := 0;
v_sql varchar2(4000);
v_ret_cde number;
e_bad_params exception;
v_iter number;
v_plvl number;
v_seq_del number;
v_max_iter number := 1000000000;
function delete_bott_row
return number
is
v_sql varchar2(4000);
v_ptname varchar2(30); -- parent table name
v_ppkname varchar2(30); -- parent primary key constraint name
v_ppkcname varchar2(30); -- parnet primary key column name
v_prowid rowid;
v_crowid rowid;
v_ctname varchar2(30); -- child table name
v_cfkname varchar2(30); -- child foreign key constraint name
v_cfkcname varchar2(30); -- child foreign key column name
v_ins number;
v_seq_ins number;
v_sqlerrm varchar2(4000);
v_sqlcode number;
e_const_viol exception;
pragma exception_init(e_const_viol, -2292);
e_max_iter_reached exception;
begin
v_iter := v_iter + 1;
if v_iter >= v_max_iter then
raise e_max_iter_reached;
end if;
dbms_output.put_line('- Iter '||to_char(v_iter));
dbms_output.put_line('----------');
dbms_output.put_line('- Starting function delete_bott_row');
v_sql := 'select tname, rid, lvl, seq_ins from (select * from to_be_deleted where flg_del = ''N'' order by lvl desc, seq_ins desc) where rownum=1';
-- dbms_output.put_line('- SQL: '||v_sql);
execute immediate v_sql into v_ptname, v_prowid, v_plvl, v_seq_ins;
dbms_output.put_line('- Selected row: table name: '||v_ptname||', level: '||v_plvl||', seq: '||v_seq_ins);
v_sql := 'delete from '||v_ptname||' where rowid='''||v_prowid||'''';
dbms_output.put_line('- SQL: '||v_sql);
execute immediate v_sql;
dbms_output.put_line('- Row deleted !!!');
v_ret_cde := 1;
v_seq_del := v_seq_del + 1;
dbms_output.put_line('- Mark the row deleted');
v_sql := 'update to_be_deleted set flg_del = ''Y'', seq_del = '||to_char(v_seq_del)||' where tname='''||v_ptname||''' and rid='''||v_prowid||'''';
-- dbms_output.put_line('- SQL: '||v_sql);
execute immediate v_sql;
-- dbms_output.put_line('- Updated table to_be_deleted, row marked deleted');
-- dbms_output.put_line('- End of iter '||to_char(v_iter));
dbms_output.put_line('----------');
-- call function delete_bott_row recursively
v_ret_cde := delete_bott_row;
return 0;
exception
when no_data_found then
dbms_output.put_line('- Table to_be_deleted is empty, delete cascade has completed successfully.');
v_ret_cde := 0;
return 0;
when e_const_viol then
v_sqlcode := SQLCODE;
v_sqlerrm := SQLERRM;
v_ret_cde := v_sqlcode;
dbms_output.put_line('>Constraint Violation. Record has children');
-- dbms_output.put_line('Error code: '||to_char(v_sqlcode));
v_cfkname := substr(v_sqlerrm,instr(v_sqlerrm,'.')+1,instr(v_sqlerrm,')') - instr(v_sqlerrm,'.')-1);
dbms_output.put_line('>Child FK name: '||v_cfkname);
select table_name, column_name
into v_ctname, v_cfkcname
from user_cons_columns
where constraint_name=v_cfkname;
dbms_output.put_line('>Child table name: '||v_ctname||'. FK column name: '|| v_cfkcname);
select constraint_name, column_name
into v_ppkname, v_ppkcname
from user_cons_columns
where constraint_name = (select r_constraint_name
from user_constraints
where constraint_name=v_cfkname);
dbms_output.put_line('>Parent PK/UK name: '||v_ppkname||'. Parent PK/UK column: '||v_ppkcname);
v_sql := 'insert into to_be_deleted(tname, rid, lvl, seq_ins, flg_del) '||
'select '''||v_ctname||''', rowid, '||to_char(v_plvl+1)||', rownum, ''N'' '||
'from '||v_ctname||' '||
'where '||v_cfkcname||' =any (select '||v_ppkcname||' from '||v_ptname||' where rowid =any (select rid from to_be_deleted where tname = '''||v_ptname||'''))';
-- dbms_output.put_line('- SQL: '||v_sql);
execute immediate v_sql;
select count(*)
into v_ins
from to_be_deleted
where lvl = v_plvl+1
and tname = v_ctname
and flg_del = 'N';
dbms_output.put_line('>Found '||to_char(v_ins)||' child records which were added to table to_be_deleted');
v_ret_cde := delete_bott_row;
return v_ret_cde;
when e_max_iter_reached then
dbms_output.put_line('Maximum iterations reached. Terminating procedure.');
raise;
when others then
raise;
end delete_bott_row;
begin
dbms_output.put_line('Beginning');
dbms_output.put_line('================================');
-- validate p_table
begin
select 'Y'
into dummy
from user_tables
where table_name=upper(p_tname);
exception
when no_data_found then
v_param_val := 1;
dbms_output.put_line('Table '||p_tname||' does not exist.');
raise e_bad_params;
end;
dbms_output.put_line('- Parameter p_tname validated');
-- validate p_where
begin
execute immediate 'select ''Y'' from '||p_tname||' where '||p_where INTO dummy;
exception
when no_data_found then -- where clause returns no records
dbms_output.put_line('Record(s) not found. Check your where clause parameter');
v_param_val := 2;
raise e_bad_params;
when too_many_rows then -- found multiple records means it is ok
null;
when others then -- any other records means where clause has something wrong.
dbms_output.put_line('Where clause is malformed');
v_param_val := 2;
raise e_bad_params;
end;
dbms_output.put_line('- Parameter p_where validated');
if v_param_val > 0 then raise e_bad_params; end if;
v_iter := 0;
v_plvl := 1;
v_seq_del := 0;
v_sql := 'insert into to_be_deleted(tname, rid, lvl, seq_ins, flg_del) select '''||upper(p_tname)||''', rowid, '||to_char(v_plvl)||', rownum, ''N'' from '||p_tname||' where '||p_where;
dbms_output.put_line('- Inserting initial record');
dbms_output.put_line('- SQL: '||v_sql);
execute immediate v_sql;
dbms_output.put_line('- Record(s) inserted');
dbms_output.put_line('- Calling function delete_bott_row to delete last row of table to_be_deleted');
dbms_output.put_line('-----------------------------------');
v_ret_cde := delete_bott_row;
-- dbms_output.put_line('- Back from function delete_bott_row');
-- dbms_output.put_line('Return code: '||to_char(v_ret_cde));
dbms_output.put_line('- End of procedure');
exception
when e_bad_params then
dbms_output.put_line('Bad parameters, exiting.');
end;
show errors
spool prc_delete_cascade.log
-- Call to the procedure
exec prc_delete_cascade('xent','xent_id between 1669 and 1670')
select tname "Table Name", count(*) "Rows deleted"
from to_be_deleted
group by tname;
spool off
set lines 120
select *
from to_be_deleted
order by seq_del;
prompt Now commit or rollaback deletions.
-- commit;
-- rollback;Edited by: Rodolfo4 on Mar 23, 2011 10:45 AMInteresting.
I see a few areas where this could be useful. Elimiating specific test records from a Test DB for example.
Some comments:
<li>Since this is a recursive logic you must add a stop criteria. In this case I would add a max iteration variable. If that one is reached, raise an error message and let the procedure stop with that error.</li>
<li>The when others exception at the end should be removed completely</li>
<li>The when others exception in the middle should be replaced by a specific exception that handles the -2292 error</li>
<li>A list of tables where no record should be deleted could be usefull. If the logic would encounter such a table, it should also stop. This would be to prevent that data from some system critical tables could be deleted per accident.</li>
<li>The reference from the FK constraint to the PK constraint should include the table name and if possible the owner (as long as you use user_* views the owner is always the same. But we could extend this to the ALL_* views). I never met a system where different tables have the identical FK constraint names, however just make this fool proof.</li> -
How to insert BLOB datatype image using PL/SQL Procedure and SQL Loader
Hi,
How to insert an image into database using PL/SQL Procedure and also how to insert using SQL Loader. Please help by giving sample code and process description.
Thanks,
Vijay Vhttp://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:232814159006
Maybe you are looking for
-
New MBP and lost contacts I had.
I had them on a back-up drive but they are gone from there from that drive and Im PO'd....need to xfer my contact list from iTouch to new computer. is there a way or Im I loosing my mind or both. I thought I could use my iTouch as a backup but when I
-
How can I resize my iTunes window if it's stuck?
Hi, Ever since I switched to the 15-inch Macbook Pro, my iTunes window doesn't fit in the actual screen and cuts off half way, showing only half of iTunes at a time. Because of this, I can't use the bottom-right corner to adjust it to the size I want
-
How do I set the default site in iWeb '09
I have several sites built in iWeb, like most people do. However I want one specific site to be the default. How do I tell iWeb which folder to pick? In addition to this question, I have iWeb on another computer that I would like to upload a site I'v
-
Paging on Windows 2008 - still there
Windows 2008 SP2 32 GB RAM Oracle 10.2.0.4 Despite using Windows 2008 and the alleged improved memory algorithm I still see a lot of paging going on: KB in/h ====== 530.256 1.025.092 83.784 93.620 73.324 73.280 73.488 76.532 96.856 66.780 74.284 80.8
-
Hyperion Planning form importing not working
I created a new application in hyperion planning, and migrated forms from the previous application by FormDefUtil. The form migration failed with error message: Unable to find JDBC_CATALOG key for application: NCGC_LP Can not login to application: NC