HELP WITH BLOB CRYPTING
HI Guys,
i can't get the dbms_crypto procedure to work correctly:
i've a table where i upload data via apex, all stored in a blob table of mine and the download proc as well to download file: i can't crypt the blob file.
my custom proc is triggered:
As you can see only update, such it doesn't crypt nothing ;-(
I've copied only the encrypt proc such the problem has to be similare for the other proc as well.
Probably the error is using the same blob as source as destination, however i can't fix this, and i think is possible to 'work' on the same blob.
Note that only for test purpose i have copied the blob from another col of the same table (BLOB_CONTENT_NON_CRYPT), so my col has data in it.
create or replace TRIGGER BI_BNFOWNFL BEFORE INSERT ON BNFOWNFL
FOR EACH ROW
DECLARE
B BLOB;
begin
IF INSERTING THEN
select "BNFOWNFL_SEQ".nextval into :NEW.ID from dual;
END IF;
IF UPDATING THEN
B:=:OLD.BLOB_CRYPTED;
P_ENCRYPT.encrypt_ssnBLOB(B);
:NEW.BLOB_CRYPTED:=B;
NULL;
END IF;
end;
MY PROC IS AS FOLLOWS:
PROCEDURE encrypt_ssnBLOB( p_ssn IN OUT NOCOPY BLOB);
PROCEDURE decrypt_ssnBLOB( p_ssn IN OUT NOCOPY BLOB);
G_KEY RAW(32) := UTL_I18N.STRING_TO_RAW( 'ZORRO', 'AL32UTF8' );
PROCEDURE encrypt_ssnBLOB( p_ssn IN OUT NOCOPY BLOB )
IS
BEGIN
dbms_crypto.encrypt
( dst => p_ssn,
src => p_ssn,
typ => DBMS_CRYPTO.DES_CBC_PKCS5,
key => G_KEY );
END encrypt_ssnBLOB;
Thanx a lot for help
Hi, Marcello, glad to hear - you got the process working, but after i reread your post ( if i understood you correctly ) - i have some doubts on your procedure - could you get the original documents by decrypting your encrypted documents successfully ?
The main problem with it in my opinion - you can't pass to the encrypt procedure the same lob locator for source and for destination. Docs says - the output lob will be overwritten and it will be indeed (http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_crypto.htm#sthref1552).
To demonstrate this i set up some examples - in the first part i encrypt using the same lob locator passed to the encrypt procedure, in the second i created a trigger which works properly ( i.e. the encrypted part can be decrypted again, the encryption part of trigger body can/should be placed in the procedure of course). Another issue - with assignment like A_LOB := :NEW.LOB_COLUMN within the trigge - on this way your new variable points to the same lob as :NEW.LOB_COLUMN and therefor can not be used as destination lob parameter for the encrypt procedure - that is why i used in my example DBMS_LOB.COPY procedure.
scott@ORA102> DECLARE
2 l_blob_1 BLOB;
3 l_blob_2 BLOB;
4 G_KEY RAW(32) := UTL_I18N.STRING_TO_RAW( lpad('ZORRO',8), 'AL32UTF8' );
5 BEGIN
6 dbms_lob.createtemporary(l_blob_1,TRUE);
7 dbms_lob.createtemporary(l_blob_2,TRUE);
8 l_blob_1 := UTL_I18N.STRING_TO_RAW('Hello, world!','AL32UTF8');
9 l_blob_2 := UTL_I18N.STRING_TO_RAW('God save the queen','AL32UTF8');
10 dbms_output.put_line('1 LOB content before encryption: '||rawtohex(l_blob_1));
11 dbms_output.put_line('2 LOB content before encryption: '||rawtohex(l_blob_2));
12 dbms_crypto.encrypt( dst => l_blob_1,src => l_blob_1,typ => DBMS_CRYPTO.DES_CBC_PKCS5,key => G_KEY );
13 dbms_crypto.encrypt( dst => l_blob_2,src => l_blob_2,typ => DBMS_CRYPTO.DES_CBC_PKCS5,key => G_KEY );
14 dbms_output.put_line('1 LOB content after encryption: '||rawtohex(l_blob_1));
15 dbms_output.put_line('2 LOB content after encryption: '||rawtohex(l_blob_2));
16 -- now try to decrypt the "encrypted" blob - it seems, we got the junk
17 -- to accomplish it - l_blob_1 should be properly encrypted form of l_blob_2:
18 dbms_crypto.decrypt( dst => l_blob_1,src => l_blob_2,typ => DBMS_CRYPTO.DES_CBC_PKCS5,key => G_KEY );
19 dbms_output.put_line('2 LOB content after PROPER decryption: '||rawtohex(l_blob_1));
20 END;
21 /
1 LOB content before encryption: 48656C6C6F2C20776F726C6421
2 LOB content before encryption: 476F6420736176652074686520717565656E
1 LOB content after encryption: 501A81E5BE464DB3
2 LOB content after encryption: 501A81E5BE464DB3
2 LOB content after PROPER decryption:
PL/SQL procedure successfully completed.
scott@ORA102>
scott@ORA102> DROP TABLE test_encryption;
Table dropped.
scott@ORA102> CREATE TABLE test_encryption(ID NUMBER,plain_blob BLOB,encrypted_blob BLOB);
Table created.
scott@ORA102> INSERT INTO test_encryption(ID,plain_blob,encrypted_blob)
2 VALUES(1,rawtohex('Hello World!'),NULL);
1 row created.
scott@ORA102> CREATE OR REPLACE TRIGGER trg_test_encryption
2 BEFORE UPDATE ON test_encryption
3 FOR EACH ROW
4 DECLARE
5 G_KEY RAW(32) := UTL_I18N.STRING_TO_RAW( lpad('ZORRO',8), 'AL32UTF8' );
6 l_blob BLOB;
7 BEGIN
8 dbms_lob.createtemporary(:NEW.encrypted_blob,TRUE);
9 dbms_lob.open(:NEW.encrypted_blob,dbms_lob.lob_readwrite);
10 dbms_lob.open(:NEW.plain_blob,dbms_lob.lob_readonly);
11 dbms_lob.copy(:NEW.encrypted_blob,:NEW.plain_blob,dbms_lob.getlength(:NEW.plain_blob),1,1);
12 dbms_crypto.encrypt( dst => :NEW.encrypted_blob,src =>:NEW.plain_blob ,typ => DBMS_CRYPTO.DES_CBC_PKCS5,key => G_KEY );
13 END;
14 /
Trigger created.
scott@ORA102> UPDATE test_encryption SET ID=ID;
1 row updated.
scott@ORA102> COMMIT;
Commit complete.
scott@ORA102> col plain for a20
scott@ORA102> col enc for a20
scott@ORA102>
scott@ORA102> SELECT
2 dbms_lob.getlength(plain_blob) len_plain,
3 dbms_lob.substr(plain_blob,dbms_lob.getlength(plain_blob),1) plain,
4 dbms_lob.getlength(encrypted_blob) len_enc,
5 dbms_lob.substr(encrypted_blob,dbms_lob.getlength(encrypted_blob),1) enc
6 FROM test_encryption;
LEN_PLAIN PLAIN LEN_ENC ENC
12 48656C6C6F20576F726C 16 6784483CC01870D1BE58
6421 FB64909783DB
scott@ORA102>
scott@ORA102> -- now try to decrypt the encrypted value
scott@ORA102> DECLARE
2 G_KEY RAW(32) := UTL_I18N.STRING_TO_RAW( lpad('ZORRO',8), 'AL32UTF8' );
3 l_src BLOB;
4 l_tgt BLOB;
5 BEGIN
6 dbms_lob.createtemporary(l_tgt,TRUE);
7 SELECT encrypted_blob INTO l_src FROM test_encryption FOR UPDATE;
8 dbms_lob.open(l_tgt,dbms_lob.lob_readwrite);
9 dbms_lob.open(l_src,dbms_lob.lob_readonly);
10 dbms_crypto.decrypt( dst => l_tgt,src => l_src ,typ => DBMS_CRYPTO.DES_CBC_PKCS5,key => G_KEY );
11 dbms_output.put_line(utl_raw.cast_to_varchar2(l_tgt));
12 ROLLBACK;
13 END;
14 /
Hello World!
PL/SQL procedure successfully completed.
Best regards
Maxim
Similar Messages
-
Need URGENT help with BLOB!!!!
Hi,
I am using a certain java server that has the capability of persisting objects to permanent storage (Oracle 8.1.5.0 in my case).
The server automatically creates all necessary tables, and some of them have columns of BLOB datatypes in them.
Then server retrieves a row of data and attempts to figure out how big is the size of the single BLOB record.
All these queries are in xml configuration files and the server's java code uses them to access the database. I can not modify the datatypes during table creation without modifying actual server code, which I don't want to do for obvious reasons. I can't use stored procedures to figure out the size of the BLOB either for the same reason.
Now here is the problem:
Some of the logic of the code depends on queries that are supposed to return the size of BLOB data. Queries look like this:
SELECT DATALENGTH(col_a)
FROM table_A
WHERE col_b = 'something'
and of course col_a is in table_A and its datatype is BLOB (The sql above works on MS SQL).
IS THERE AN EQUIVALENT OF datalength() IN ORACLE?
I have unsuccessfully tried LENGTH(blob), which throws ORA-00932 inconsistent datatypes error. Also tried octet-length(), BLOB SIZE() with same results (different error: ORA-00923 FROM keyword not found where expected).
Any ideas?
Your help is greatly appreciated,
Gugo MThank you so much!
Looks very simple (probably is for a dba).
Thanks again.
Gugo -
Hello everybody.
Im working with Oracle 10G R 1.2
Im trying to upload a file from filesystem (/tmp) into a BLOB item in memory. (lob_loc)
I have a ora-22275 error with those lines
src_file := bfilename(l_directory,l_filename);
dbms_lob.fileopen(src_file, dbms_lob.file_readonly);
v_length := dbms_lob.getlength(src_file);
dbms_lob.loadfromfile(Lob_loc, src_file, v_length
I have read some documentation and it say that I must initialize the Blob Item (lob_loc)
How I can do this?
Thanks in advanced to everybody and regards to all.I don't know, what type of modification you will do in the "binary" file. However here is an example of loading a file into a temporary LOB then modify it and then inserting it into table.
SQL> CREATE TABLE test_blob (id INTEGER,blob_col BLOB);
Table created.
SQL> DECLARE
2 file_handle UTL_FILE.file_type;
3 v_fname VARCHAR2(20) := 'mytest.txt';
4 buffer VARCHAR2(32767);
5 BEGIN
6 file_handle := UTL_FILE.fopen('TEST_DIR', v_fname, 'W');
7 buffer := 'This is first line';
8 UTL_FILE.put_line(file_handle, buffer, TRUE);
9 buffer := 'This is second line';
10 UTL_FILE.put_line(file_handle, buffer, TRUE);
11 buffer := 'This is third line';
12 UTL_FILE.put_line(file_handle, buffer, TRUE);
13 UTL_FILE.fclose(file_handle);
14 END;
15 /
PL/SQL procedure successfully completed.I will use the file created above (three lines) into my LOB.
SQL> DECLARE
2 v_src_loc BFILE := BFILENAME('TEST_DIR', 'mytest.txt');
3 v_amount INTEGER;
4 v_b BLOB:=EMPTY_BLOB; -- Necessary to initialize.
5 v_offset INTEGER; -- Where to write.
6 my_var VARCHAR2(32767):='This is fourth line';
7 v_lobloc BLOB;
8 BEGIN
9 DBMS_LOB.OPEN(v_src_loc, DBMS_LOB.LOB_READONLY);
10 v_amount := DBMS_LOB.GETLENGTH(v_src_loc);
11 DBMS_OUTPUT.put_line('The length before modification:'||v_amount);
12 -- initalize the new blob
13 dbms_lob.createtemporary(v_b,TRUE);
14 DBMS_LOB.LOADFROMFILE(v_b, v_src_loc, v_amount); -- Loading from file
15 ---Adding one line
16 Dbms_LOB.WRITEAPPEND(v_b,length(my_var),utl_raw.cast_to_raw(my_var));
17 INSERT INTO test_blob
18 VALUES
19 (1, EMPTY_BLOB())
20 RETURNING blob_col INTO v_lobloc;
21 v_amount := DBMS_LOB.GETLENGTH(v_b);
22 DBMS_OUTPUT.put_line('The length after modification:'||v_amount);
23 --Inserting the modified LOB into file
24 DBMS_LOB.copy(v_lobloc,v_b,v_amount);
25 DBMS_LOB.CLOSE(v_src_loc);
26 END;
27 /
PL/SQL procedure successfully completed.
SQL> commit;
Commit complete.This step is just for verification purpose!. The file had three lines, it should have four lines.
SQL> DECLARE
2 v_lob_loc BLOB;
3 CURSOR cur IS
4 SELECT id, blob_col FROM test_blob;
5 v_rec test_blob%ROWTYPE;
6 BEGIN
7 OPEN cur;
8 LOOP
9 FETCH cur
10 INTO v_rec;
11 v_lob_loc := v_rec.blob_col;
12 DBMS_OUTPUT.PUT_LINE('The length is: ' ||
13 DBMS_LOB.GETLENGTH(v_lob_loc));
14 DBMS_OUTPUT.PUT_LINE('The ID is: ' || v_rec.id);
15 DBMS_OUTPUT.PUT_LINE('The blob is read: ' ||
16 UTL_RAW.CAST_TO_VARCHAR2(DBMS_LOB.SUBSTR(v_lob_loc,
17 200,
18 1)));
19 EXIT WHEN cur%NOTFOUND;
20 END LOOP;
21 CLOSE cur;
22 END;
23 /
PL/SQL procedure successfully completed.
SQL> set serverout on
SQL> /
The length is: 80
The ID is: 1
The blob is read: This is first line
This is second line
This is third
line
This is fourth line -
How to use insert row with BLOB to Oracle when use connection pool?
Hi, All,
I am writing a program to store files (mapped to be a column with BLOB datatype
in the table) to Oracle database.
But I always get java.lang.ClassCastException:weblogic.jdbc.rmi.SerialBlob
Here is my code, please help. Thanks a lot!!
String sqlNewRow = "insert into documents (id, companyid, updatedate, description,
document, addby, title) ";
sqlNewRow += "values (?, ?, TO_DATE(?, 'MM/DD/YY'), ?, EMPTY_BLOB(), ?,
con.setAutoCommit(false);
ps = con.prepareStatement(sqlNewRow);
ps.setInt(1, documentid);
ps.setInt(2, companyid);
ps.setString(3, updatedate);
ps.setString(4, description);
ps.setString(5, username);
ps.setString(6, filename);
ps.executeUpdate();
ps.close();
String sqlLockRow = "select document from documents where id = ? for update";
java.sql.PreparedStatement pst = con.prepareStatement(sqlLockRow);
pst.setInt(1, documentid);
java.sql.ResultSet rset = pst.executeQuery();
rset.next();
java.sql.Blob dbBlob = rset.getBlob(1);
out.println("it's=" + dbBlob.getClass());
OutputStream dbBlobOut = ((weblogic.jdbc.vendor.oracle.OracleThinBlob)dbBlob).getBinaryOutputStream();
dbBlobOut.write(oneString.getBytes());
dbBlobOut.close();
rset.close();
pst.close();Have you defined
OutputStream dbBlobOut
as weblogic.jdbc.vendor.oralce.OracleThinBlob?
Mitesh
Almond wrote:
Hi, All,
I am writing a program to store files (mapped to be a column with BLOB datatype
in the table) to Oracle database.
But I always get java.lang.ClassCastException:weblogic.jdbc.rmi.SerialBlob
Here is my code, please help. Thanks a lot!!
String sqlNewRow = "insert into documents (id, companyid, updatedate, description,
document, addby, title) ";
sqlNewRow += "values (?, ?, TO_DATE(?, 'MM/DD/YY'), ?, EMPTY_BLOB(), ?,
con.setAutoCommit(false);
ps = con.prepareStatement(sqlNewRow);
ps.setInt(1, documentid);
ps.setInt(2, companyid);
ps.setString(3, updatedate);
ps.setString(4, description);
ps.setString(5, username);
ps.setString(6, filename);
ps.executeUpdate();
ps.close();
String sqlLockRow = "select document from documents where id = ? for update";
java.sql.PreparedStatement pst = con.prepareStatement(sqlLockRow);
pst.setInt(1, documentid);
java.sql.ResultSet rset = pst.executeQuery();
rset.next();
java.sql.Blob dbBlob = rset.getBlob(1);
out.println("it's=" + dbBlob.getClass());
OutputStream dbBlobOut = ((weblogic.jdbc.vendor.oracle.OracleThinBlob)dbBlob).getBinaryOutputStream();
dbBlobOut.write(oneString.getBytes());
dbBlobOut.close();
rset.close();
pst.close(); -
Problem with BLOB fields (DBMS_LOB)
I want to read a word document from hard disc and save it into a BLOB field with using DBMS_LOB package. but when using it I always receive error "Invalid LOB locator specified" even I use oracle examples.
I use FormBuilder 6.0.
How can I do this. plz give me a code.
Thanks so much>
help plzzz
>
If you want help in the forum you need to use English when you post.
You also need to actually ask a question or present the issue that you need help with. Just saying you nave a problem and then posting code isn't sufficient.
Please edit your post and provide the English version of your code, comments, error messages and your action question or issue. -
Weird Problem with BLOB CMP field
Hi,
I am trying to deploy an EJB2.0 CMP Bean in Weblogic6.1 .The Bean has one of the CMP Field as a serializable object mapped to a BLOB Datatype in Oracle8i
When i try to creae this Entity Bean
I get "java.io.IOException: ORA-22920: row containing the LOB value is not locked" as a nested exception.
When i increased the isolation level . I got "java.io.IOException: ORA-01002 fetch out of sequence" as the nested exception
And one more horrible thing that is happening is the other arguments to the create method are getting updated in the DB except the Blob field(Supposed to rollback? when there is an EJB Exception ??)
Any thoughts? Comments?
Regards
SathyaHi,
I seem to recall that there are multiple issues with BLOBS & WLS. I'll describe my setup, and you can see if your missing anything:
- In weblogic-cmp-rdbms-jar.xml you need to set the column type as a Blob:
<field-map>
<cmp-field>binary</cmp-field>
<dbms-column>binary</dbms-column>
<dbms-column-type>OracleBlob</dbms-column-type>
</field-map>
- In weblogic-ejb-jar.xml you may need to set the isolation level of your set method:
<transaction-isolation>
<isolation-level>TRANSACTION_READ_COMMITTED_FOR_UPDATE</isolation-level>
<method>
<ejb-name>TerminalSoftwareKernelBDO</ejb-name>
<method-name>setBinary</method-name>
</method>
</transaction-isolation>
- The bean get/set methods should look like this:
public abstract void setBinary(java.lang.Object binary);
public abstract java.lang.Object getBinary();
- In WLS 6.1 up to Service Pack 2 (I don't know about SP3 yet), BLOBs are incorrectly implemented. For some (odd) reason you can only put serialized objects into the DB... I think this means that if you have a BLOB put in by anything but WLS, WLS get very unhappy. So empty out your table with the blobs first.
Hope that helps.
Daniel. -
Can LogMiner capture DMLs against rows with Blob datatype?
Hi,
Can LogMiner catch DMLs against rows with Blob datatype?
if a Blob column is 4G big each row, and you delete millions of
rows, but your redo log files is only 600M totally, I don't know (not sure) how those before-images of data can be stored in redo logfiles (also, you may need a very large log_archive_dest to hold those before-images )
please help to explain.
Thanks
RoyHi,
Can LogMiner catch DMLs against rows with Blob datatype?
if a Blob column is 4G big each row, and you delete millions of
rows, but your redo log files is only 600M totally, I don't know (not sure) how those before-images of data can be stored in redo logfiles (also, you may need a very large log_archive_dest to hold those before-images )
please help to explain.
Thanks
Roy -
Problem while importing table with blob datatype
hi i am having a database 9i on windows xp and dev database 9i on AIX 5.2
while i am taking export of normal tables and trying to import i am successful.but when i am trying to import a table with blob datatype it is throwing "tablespace <tablespace_name> doesn't exist" error
here how i followed.
SQL*Plus: Release 9.2.0.1.0 - Production on Mon Oct 8 14:08:29 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Enter user-name: test@test
Enter password: ****
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
SQL> create table x(photo blob);
Table created.
exporting:
D:\>exp file=x.dmp log=x.log tables='TEST.X'
Export: Release 9.2.0.1.0 - Production on Mon Oct 8 14:09:40 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Username: pavan@test
Password:
Connected to: Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
Export done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
About to export specified tables via Conventional Path ...
Current user changed to TEST
. . exporting table X 0 rows exported
Export terminated successfully without warnings.
importing:
D:\>imp file=x.dmp log=ximp.log fromuser='TEST' touser='IBT' tables='X'
Import: Release 9.2.0.1.0 - Production on Mon Oct 8 14:10:42 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Username: system@mch
Password:
Connected to: Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Oracle Data Mining op
tions
JServer Release 9.2.0.6.0 - Production
Export file created by EXPORT:V09.02.00 via conventional path
Warning: the objects were exported by PAVAN, not by you
import done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
import server uses US7ASCII character set (possible charset conversion)
. importing TEST's objects into IBT
IMP-00017: following statement failed with ORACLE error 959:
"CREATE TABLE "X" ("PHOTO" BLOB) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS "
"255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1) TABLESPACE "TESTTB"
"S" LOGGING NOCOMPRESS LOB ("PHOTO") STORE AS (TABLESPACE "TESTTBS" ENABLE "
"STORAGE IN ROW CHUNK 8192 PCTVERSION 10 NOCACHE STORAGE(INITIAL 65536 FREE"
"LISTS 1 FREELIST GROUPS 1))"
IMP-00003: ORACLE error 959 encountered
ORA-00959: tablespace 'TESTTBS' does not exist
Import terminated successfully with warnings.
why it is happening for this table alone?plz help me
thanks in advanceHere is exerpt from {
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:378418239571}
=============================================
Hi Tom,
I have a dump file containing blob datatypes, when i import the dump file in a schema it gives an
error stating that the tablespace for Blob datatype does not exists. My question is how do i import
the dump file in the default tablespace of the importing user.
Followup March 2, 2004 - 7am US/Eastern:
You'll have to precreate the table.
do this:
imp userid=u/p tables=that_table indexfile=that_table.sql
edit that_table.sql, fix up the tablespace references to be whatever you want to be, run that sql.
then imp with ignore=y
for any MULTI-SEGMENT object (iot's with overflows, tables with lobs, partitioned tables, for
example), you have to do this -- imp will not rewrite ALL of the tablespaces in that
multi-tablespace create -- hence you either need to have the same tablespaces in place or precreate
the object with the proper tablespaces.
Only for single tablespace segments will imp rewrite the create to go into the default if the
requested tablespace does not exist.
===================================================
To summarize: precreate target table when importing multi-segment tables -
Typical problem with BLOB.
while i am using blob to store file content
(for word documents more than 400 kb) iam facing this error.
java.sql.sqlexception : ORA-01401:INSERTED VALUE TOO LARGE FOR COLUMN
if it is some pdf files more than this size it is uploading.
pls help me in this regard.
Thanks in advance....>
help plzzz
>
If you want help in the forum you need to use English when you post.
You also need to actually ask a question or present the issue that you need help with. Just saying you nave a problem and then posting code isn't sufficient.
Please edit your post and provide the English version of your code, comments, error messages and your action question or issue. -
WebServices with BLOB IN params
Hi
I have managed to deploy DB procedures as native WebServices - great functionality!
I would like to do this with BLOB parameters passed IN to the procedure.
As the web service is XML based the BLOB must be cast (converted) to a character representation.
How to do this?
The procedure would be something like:
create_event(p_event_code IN varchar2,
p_event_date IN varchar2,
p_BLOB IN BLOB);
This would work in PLSQL but not as a web service.
How can I change the BLOB parameter to something that XML can represent?
Once I get the raw data in the procedure I can convert to a BLOB and insert into the table.
Any help would be appreciated.
Regards
ChrisHi Chris!
Perhaps you could use the CONVERTTOCLOB and CONVERTTOBLOB procedures from the package DBMS_LOB, which convert from the binary representation of a BLOB type to character data in a CLOB or NCLOB type and viceversa.
Regards,
Sergio -
Can anyone help with database driven design
Hi,
I would like to determine the best way to serve large amounts
of text on an html page. I have manuals with lots of links that I
want to add to a website. I would like to employ database driven
web development in my design, would this be a good use for it? If
so would you suggest php and what database?
Thanks!
Please forgive me for double posting, I posted this in the
general forum but maybe should have done it here first?I would say it totally depends on the format that the manuals
are in. If they're HTML than you can store them as BLOB's in mysql
and you're life will be rather easy. You would need to parse the
blob output for URLs but that's about it.
However, if the manuals are in PDF than a database wouldn't
help with the storage of the actual files, however you can use
either XML or a DB (i.e. mysql) to store the metadata about that
manual so that you can at least make the site searchable.
A little more information about your data/website would
probably be helpful.
Aram -
Hello,
Did any one have experience table re-org with BLOB object column?
Please let me know the best way doing it to claiming space.
I appreicate your help.
thanks
-AVselect 'alter table '||table_name||' move tablespace YOUR_TS'||chr(10)||
'LOB ('||column_name||') store as '||segment_name||chr(10)||
'(tablespace YOUR_TS);'
from user_lobs
/ -
Help with if statement in cursor and for loop to get output
I have the following cursor and and want to use if else statement to get the output. The cursor is working fine. What i need help with is how to use and if else statement to only get the folderrsn that have not been updated in the last 30 days. If you look at the talbe below my select statement is showing folderrs 291631 was updated only 4 days ago and folderrsn 322160 was also updated 4 days ago.
I do not want these two to appear in my result set. So i need to use if else so that my result only shows all folderrsn that havenot been updated in the last 30 days.
Here is my cursor:
/*Cursor for Email procedure. It is working Shows userid and the string
You need to update these folders*/
DECLARE
a_user varchar2(200) := null;
v_assigneduser varchar2(20);
v_folderrsn varchar2(200);
v_emailaddress varchar2(60);
v_subject varchar2(200);
Cursor c IS
SELECT assigneduser, vu.emailaddress, f.folderrsn, trunc(f.indate) AS "IN DATE",
MAX (trunc(fpa.attemptdate)) AS "LAST UPDATE",
trunc(sysdate) - MAX (trunc(fpa.attemptdate)) AS "DAYS PAST"
--MAX (TRUNC (fpa.attemptdate)) - TRUNC (f.indate) AS "NUMBER OF DAYS"
FROM folder f, folderprocess fp, validuser vu, folderprocessattempt fpa
WHERE f.foldertype = 'HJ'
AND f.statuscode NOT IN (20, 40)
AND f.folderrsn = fp.folderrsn
AND fp.processrsn = fpa.processrsn
AND vu.userid = fp.assigneduser
AND vu.statuscode = 1
GROUP BY assigneduser, vu.emailaddress, f.folderrsn, f.indate
ORDER BY fp.assigneduser;
BEGIN
FOR c1 IN c LOOP
IF (c1.assigneduser = v_assigneduser) THEN
dbms_output.put_line(' ' || c1.folderrsn);
else
dbms_output.put(c1.assigneduser ||': ' || 'Overdue Folders:You need to update these folders: Folderrsn: '||c1.folderrsn);
END IF;
a_user := c1.assigneduser;
v_assigneduser := c1.assigneduser;
v_folderrsn := c1.folderrsn;
v_emailaddress := c1.emailaddress;
v_subject := 'Subject: Project for';
END LOOP;
END;
The reason I have included the folowing table is that I want you to see the output from the select statement. that way you can help me do the if statement in the above cursor so that the result will look like this:
emailaddress
Subject: 'Project for ' || V_email || 'not updated in the last 30 days'
v_folderrsn
v_folderrsn
etc
[email protected]......
Subject: 'Project for: ' Jim...'not updated in the last 30 days'
284087
292709
[email protected].....
Subject: 'Project for: ' Kim...'not updated in the last 30 days'
185083
190121
190132
190133
190159
190237
284109
286647
294631
322922
[email protected]....
Subject: 'Project for: Joe...'not updated in the last 30 days'
183332
183336
[email protected]......
Subject: 'Project for: Sam...'not updated in the last 30 days'
183876
183877
183879
183880
183881
183882
183883
183884
183886
183887
183888
This table is to shwo you the select statement output. I want to eliminnate the two days that that are less than 30 days since the last update in the last column.
Assigneduser....Email.........Folderrsn...........indate.............maxattemptdate...days past since last update
JIM......... jim@ aol.com.... 284087............. 9/28/2006.......10/5/2006...........690
JIM......... jim@ aol.com.... 292709............. 3/20/2007.......3/28/2007............516
KIM......... kim@ aol.com.... 185083............. 8/31/2004.......2/9/2006............. 928
KIM...........kim@ aol.com.... 190121............. 2/9/2006.........2/9/2006.............928
KIM...........kim@ aol.com.... 190132............. 2/9/2006.........2/9/2006.............928
KIM...........kim@ aol.com.... 190133............. 2/9/2006.........2/9/2006.............928
KIM...........kim@ aol.com.... 190159............. 2/13/2006.......2/14/2006............923
KIM...........kim@ aol.com.... 190237............. 2/23/2006.......2/23/2006............914
KIM...........kim@ aol.com.... 284109............. 9/28/2006.......9/28/2006............697
KIM...........kim@ aol.com.... 286647............. 11/7/2006.......12/5/2006............629
KIM...........kim@ aol.com.... 294631............. 4/2/2007.........3/4/2008.............174
KIM...........kim@ aol.com.... 322922............. 7/29/2008.......7/29/2008............27
JOE...........joe@ aol.com.... 183332............. 1/28/2004.......4/23/2004............1585
JOE...........joe@ aol.com.... 183336............. 1/28/2004.......3/9/2004.............1630
SAM...........sam@ aol.com....183876.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183877.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183879.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183880.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183881.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183882.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183883.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183884.............3/5/2004.........3/8/2004............ 1631
SAM...........sam@ aol.com....183886.............3/5/2004.........3/8/2004............ 1631
SAM...........sam@ aol.com....183887.............3/5/2004.........3/8/2004............ 1631
SAM...........sam@ aol.com....183888.............3/5/2004.........3/8/2004............ 1631
PAT...........pat@ aol.com.....291630.............2/23/2007.......7/8/2008............ 48
PAT...........pat@ aol.com.....313990.............2/27/2008.......7/28/2008............28
NED...........ned@ aol.com.....190681.............4/4/2006........8/10/2006............746
NED...........ned@ aol.com......95467.............6/14/2006.......11/6/2006............658
NED...........ned@ aol.com......286688.............11/8/2006.......10/3/2007............327
NED...........ned@ aol.com.....291631.............2/23/2007.......8/21/2008............4
NED...........ned@ aol.com.....292111.............3/7/2007.........2/26/2008............181
NED...........ned@ aol.com.....292410.............3/15/2007.......7/22/2008............34
NED...........ned@ aol.com.....299410.............6/27/2007.......2/27/2008............180
NED...........ned@ aol.com.....303790.............9/19/2007.......9/19/2007............341
NED...........ned@ aol.com.....304268.............9/24/2007.......3/3/2008............ 175
NED...........ned@ aol.com.....308228.............12/6/2007.......12/6/2007............263
NED...........ned@ aol.com.....316689.............3/19/2008.......3/19/2008............159
NED...........ned@ aol.com.....316789.............3/20/2008.......3/20/2008............158
NED...........ned@ aol.com.....317528.............3/25/2008.......3/25/2008............153
NED...........ned@ aol.com.....321476.............6/4/2008.........6/17/2008............69
NED...........ned@ aol.com.....322160.............7/3/2008.........8/21/2008............4
MOE...........moe@ aol.com.....184169.............4/5/2004.......12/5/2006............629
[email protected]/27/2004.......3/8/2004............1631
How do I incorporate a if else statement in the above cursor so the two days less than 30 days since last update are not returned. I do not want to send email if the project have been updated within the last 30 days.
Edited by: user4653174 on Aug 25, 2008 2:40 PManalytical functions: http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/functions2a.htm#81409
CASE
http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96624/02_funds.htm#36899
http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96624/04_struc.htm#5997
Incorporating either of these into your query should assist you in returning the desired results. -
I installed Sunbird in one computer and my calendar has all my infos, events, and task that i would like to see on another computer that i just downloaded Sunbird into. Also, is it possible I can access Sunbird on my iphone?
Thank you in advance,Try the forum here - http://forums.mozillazine.org/viewforum.php?f=46 - for help with Sunbird, this forum is for Firefox support.
-
Hoping for some help with a very frustrating issue!
I have been syncing calendar and contacts on my iPhone 5 and Outlook 2007 using iCloud 2.1.3 (my PC is running Vista). All was well until the events I entered on the phone were showing up in Outlook, but not the other way around. I’ve tried the usual recommended steps: deselecting calendar and contacts in the iCloud control panel and then re-selecting, signing out of the panel and back in, and repairing the Outlook installation in control panel. I even uninstalled iCloud on the PC and downloaded it again (same version).
The furthest I’ve gotten is step 2 (and once, step 3) of 7 while performing “Outlook Setup For iCloud.” At that point I get, “Your setup couldn’t be started because of an unexpected error.” After the first attempt at all this, all my calendar events disappeared from Outlook, although they are still in iCloud calendar and on my phone.
Sound familiar? Any ideas on how to solve this iCloud/Outlook issue? Thanks much in advance!Hoping for some help with a very frustrating issue!
I have been syncing calendar and contacts on my iPhone 5 and Outlook 2007 using iCloud 2.1.3 (my PC is running Vista). All was well until the events I entered on the phone were showing up in Outlook, but not the other way around. I’ve tried the usual recommended steps: deselecting calendar and contacts in the iCloud control panel and then re-selecting, signing out of the panel and back in, and repairing the Outlook installation in control panel. I even uninstalled iCloud on the PC and downloaded it again (same version).
The furthest I’ve gotten is step 2 (and once, step 3) of 7 while performing “Outlook Setup For iCloud.” At that point I get, “Your setup couldn’t be started because of an unexpected error.” After the first attempt at all this, all my calendar events disappeared from Outlook, although they are still in iCloud calendar and on my phone.
Sound familiar? Any ideas on how to solve this iCloud/Outlook issue? Thanks much in advance!
Maybe you are looking for
-
Dear all, In SAP we have date in the dd.mm.yyyy format in the data whereas the Bi report displays date in the mm.dd.yyyy format. - how can this be corrected to display the date in dd.mm.yyyy format in BI. Regards, M.M
-
PDF to EPS broken in 8.1.5
I use adobe acrobat to convert images in a PDF to EPS. The process is normally straightforward: 1. open pdf 2. extract page 3. crop page 4. save as .eps As of version 8.1.5 (and possibly 8.1.4), converting to .eps causes what I think is a boundi
-
Error: Halting this cluster node due to unrecoverable service failure
Our cluster has experienced some sort of fault that has only become apparent today. The origin appears to have been nearly a month ago yet the symptoms have only just manifested. The node in question is a standalone instance running a DistributedCach
-
Terminology question: "booting as root" vs. "booting in single user mode"
Terminology question: "booting as root" vs. "booting in single user mode". Are these terms interchangeable, or is there a subtle or not-so-subtle difference? (Obviously something I don't do often.) Thanks in advance.
-
Aperture fails to run in Leopard 10.5.1
Howdy, I commented in the related thread (http://discussions.apple.com/thread.jspa?threadID=1311441&tstart=0), but as the original question is already "Answered" I figured I'd start a new thread. I installed Aperture 1.5 after updating to 10.5.1 and