Here we will discuss how to insert BLOB file in the database. For this we will create a table and then a procedure that will be used to insert records in the table.
Use following script to create an employee table
CREATE TABLE SV_EMP_PHOTO
(
ID NUMBER(3) NOT NULL,
PHOTO_NAME VARCHAR2(40),
PHOTO_RAW BLOB,
EMP_NAME VARCHAR2(80)
)
Create a directory where the photos will be stored. I am creating a directory in UNIX as our database is created in UNIX.
Create directory SV_PHOTO_DIR as ‘/u002/app/applmgr/empphoto’
Script to create a procedure SV_LOAD_IMAGE that will insert records in the table.
CREATE OR REPLACE PROCEDURE sv_load_image (
p_id NUMBER
, p_emp_name IN VARCHAR2
, p_photo_name IN VARCHAR2
)
IS
l_source BFILE;
l_dest BLOB;
l_length BINARY_INTEGER;
BEGIN
l_source := BFILENAME (‘SV_PHOTO_DIR’, p_photo_name);
INSERT INTO sv_emp_photo
(ID
, photo_name
, emp_name
, photo_raw
)
VALUES (p_id
, p_photo_name
, p_emp_name
, EMPTY_BLOB ()
)
RETURNING photo_raw
INTO l_dest;
— lock record
SELECT photo_raw
INTO l_dest
FROM sv_emp_photo
WHERE ID = p_id AND photo_name = p_photo_name
FOR UPDATE;
— open the file
DBMS_LOB.fileopen (l_source, DBMS_LOB.file_readonly);
— get length
l_length := DBMS_LOB.getlength (l_source);
— read the file and store in the destination
DBMS_LOB.loadfromfile (l_dest, l_source, l_length);
— update the blob field with destination
UPDATE sv_emp_photo
SET photo_raw = l_dest
WHERE ID = p_id AND photo_name = p_photo_name;
— close file
DBMS_LOB.fileclose (l_source);
END –sv_load_image;
/
I have copied few .jpg images in /u002/app/applmgr/empphoto in UNIX.
Execute the procedure as follows to create record in database
exec sv_load_image(1,’Pavki’,’one.jpg’)
exec sv_load_image(2,’Suresh’,’two.jpg’)
exec sv_load_image(3,’Rachna’,’three.jpg’)
Set Profile Option Value using PL/SQL
Function FND_PROFILE.SAVE can be used to set the value of any profile option at any level i.e. Site, Application, Responsibility, User etc.
Below is a sample code of how to use this function
DECLARE
a BOOLEAN;
BEGIN
a := fnd_profile.SAVE (‘CONC_REPORT_ACCESS_LEVEL’
, ‘R’
, ‘USER’
, ‘22746’
, NULL
, NULL
);
IF a
THEN
DBMS_OUTPUT.put_line (‘Success’);
COMMIT;
ELSE
DBMS_OUTPUT.put_line (‘Error’);
END IF;
END;
Share this:
Insert BLOB image file in oracle database table
Use following script to create an employee table
CREATE TABLE SV_EMP_PHOTO
(
ID NUMBER(3) NOT NULL,
PHOTO_NAME VARCHAR2(40),
PHOTO_RAW BLOB,
EMP_NAME VARCHAR2(80)
)
Create a directory where the photos will be stored. I am creating a directory in UNIX as our database is created in UNIX.
Create directory SV_PHOTO_DIR as ‘/u002/app/applmgr/empphoto’
Script to create a procedure SV_LOAD_IMAGE that will insert records in the table.
CREATE OR REPLACE PROCEDURE sv_load_image (
p_id NUMBER
, p_emp_name IN VARCHAR2
, p_photo_name IN VARCHAR2
)
IS
l_source BFILE;
l_dest BLOB;
l_length BINARY_INTEGER;
BEGIN
l_source := BFILENAME (‘SV_PHOTO_DIR’, p_photo_name);
INSERT INTO sv_emp_photo
(ID
, photo_name
, emp_name
, photo_raw
)
VALUES (p_id
, p_photo_name
, p_emp_name
, EMPTY_BLOB ()
)
RETURNING photo_raw
INTO l_dest;
— lock record
SELECT photo_raw
INTO l_dest
FROM sv_emp_photo
WHERE ID = p_id AND photo_name = p_photo_name
FOR UPDATE;
— open the file
DBMS_LOB.fileopen (l_source, DBMS_LOB.file_readonly);
— get length
l_length := DBMS_LOB.getlength (l_source);
— read the file and store in the destination
DBMS_LOB.loadfromfile (l_dest, l_source, l_length);
— update the blob field with destination
UPDATE sv_emp_photo
SET photo_raw = l_dest
WHERE ID = p_id AND photo_name = p_photo_name;
— close file
DBMS_LOB.fileclose (l_source);
END –sv_load_image;
/
I have copied few .jpg images in /u002/app/applmgr/empphoto in UNIX.
Execute the procedure as follows to create record in database
exec sv_load_image(1,’Pavki’,’one.jpg’)
exec sv_load_image(2,’Suresh’,’two.jpg’)
exec sv_load_image(3,’Rachna’,’three.jpg’)
Share this:
R12 Sales Order Line Status Flow and Meaning
OM = Order Management Sales order form
SE = Shipping Transactions or execution form
1)
Entered (OM): Order is saved but not booked2)
Booked (OM): Order is Booked.3)
Awaiting Shipping (OM): Order is booked but lines are not yet picked.Navigating to Shipping Execution, the delivery line status flow is:
4)
Not Ready to Release (SE): A delivery line may be in this status when it is interfaced manually into Shipping, is not scheduled and has no reservations. When lines are imported automatically from Order Management this status is not used5)
Released to Warehouse (SE): Pick Release has started but not yet completed. One of the reason could be allocation have not been pick confirmed. The Pick Release process creates a Move Order Header & Mover Order Line in Inventory. This is a common status for users that perform a two-step pick release process. This status indicates that inventory allocation has occurred however pick conformation has not yet taken place.6)
Ready to Release (SE): Order Line is booked and passed to shipping execution. The line is now eligible to pick Release.7)
Backordered(SE): The status of Backorderd is assigned to a line under the following circumstances.8) Shipped (SE): The delivery line is shipped confirmed.
9) Confirmed (SE): The delivery line is shipped or backordered and the trip stops are open.
10) Picked (OM): Pick release is complete, both allocations and pick confirm
11) Picked Partial (OM): This status occurs when a delivery line is not allocated the full quantity during Pick Release and Ship Confirm has not occurred
12) Interfaced (SE): The delivery line is shipped and Inventory interface concurrent process is complete.
13) Awaiting Fulfillment (OM): When fulfillment set is used, Not all shippable lines in a fulfillment set or a
configuration are fulfilled
14) Fulfilled (OM): All lines in a fulfillment set are fulfilled.
15) Interfaced to Receivables (OM): The order is linked with Receivables and the invoice is created.
16) Partially Interfaced to Receivables (OM): This status is used in a PTO flow and indicates that the particular PTO item is required for revenue.
17) Closed (OM): Closed indicates that the line is closed.
18) Canceled (OM): Indicates that the line has been completely canceled. No further processing will occur for this line.
Share this:
Resolving ORACLE ERROR:ORA-28000: the account is locked
sqlplus “/ as sysdba”
Once logged in as SYSDBA, you need to unlock the scott account
SQL> alter user scott account unlock;
SQL> grant connect, resource to scott;
Share this:
Add Responsibility using Sqlplus
FND_USER_RESP_GROUPS_API.LOAD_ROW
(X_USER_NAME => ‘ANATESH’,
X_RESP_KEY => ‘APPLICATION_DEVELOPER’,
X_APP_SHORT_NAME => ‘FND’,
X_SECURITY_GROUP => ‘STANDARD’,
X_OWNER => ‘SYSADMIN’,
X_START_DATE => Trunc(sysdate),
X_END_DATE => NULL,
X_DESCRIPTION => NULL,
X_LAST_UPDATE_DATE => Trunc(sysdate));
COMMIT;
END;
Share this: