Insert Blob in a table
Hi to all ...
I have on the applicatin server some file image ... pdf etc. and I need to insert it on a blob col of a table ...
Can someone suggest to me some line code for read a file and insert it in a blob table ...
I have PHP Version 4.3.9 ...
Thank's in advance ...
Please easy code i'm neophyte in PHP ....
Please refer
http://www.devarticles.com/c/a/MySQL/Blobbing-Data-With-PHP-and-MySQL/1/
http://www.phpeveryday.com/articles/PDO-Alternative-Retrieve-BLOB-Data-P554.html
Similar Messages
-
Inserting blob image into table
ora.gif, image001.jpeg are the image names .these are stored in the location D:\oracle\Bfiles
create directory BFILE_FILES as ‘D:\oracle\Bfiles';
i want to insert the 2 images into table using blob
how to create the table and how to insert and how to test that image is inserted or notTom Kyte has it all Here
-
How can I Insert a BLOB into a Table from Java?
I have a Java class that creates an xml file from data in a non-sql data source. After it successfully creates and saves the file it inserts a record into an Oracle table to log the fact that an xml file was created.
Now the guy in the warehouse wants to get an email with the file attached. I have been looking into the apex_mail package, because we already have a procedure using htmldb_mail. However, that procedure is on our old server with HTMLDB 1.6 and it is not sending any attachments.
I think I have most of the apex_mail worked out, but I'm stuck on the blob thing. This is what I have so far:
* The Java program creates a String object called xmlDoc
* After xmlDoc is fully constructed, the file is written to the (Linux) server. This is accomplished with the following:
// writing the xmlDoc
fileDest = "/home/ewh/XMLOUT/";
fileName = "OrderEW_"\+orderNbr\+"_"\+ticketNbr\+".xml";
FileWriter fstream = new FileWriter(fileDest+fileName);
BufferedWriter out = new BufferedWriter(fstream);
out.write(xmlDoc);
out.close();
* Next I insert a record into the log file with:
// Add a record to the Oracle order_email table to let the mail process know that
// a new xml file is ready to be e-mailed to operations.
emailLogInsertQuery = " insert into ewh.order_email ( file_name, create_date ) ";
emailLogInsertQuery += " values ('"\+fileName\+"', sysdate)";
oraAction = oraStmt.executeUpdate( emailLogInsertQuery );
All of this is working fine so far. Now, I have added a blob type field to the order_email table, but I have no idea what to stick in there so that I have everything that apex_mail.add_attachment needs.
Here's a description of the order_email table:
SQL> desc ewh.order_email;
Name Type Nullable Default Comments
FILE_NAME VARCHAR2(30) Y
FILE_BLOB BLOB Y
CREATE_DATE DATE Y
SEND_DATE DATE Y
Thanks ever so much,
Gregory
Edited by: Canis Polaris on Jun 10, 2009 2:10 PM - Added escapes as necessary to show the plus signs around Java variables.Hi,
From within APEX one can enter blob data in database tables, view the data and also update the data. Also one can send a blob attachment in an email.
May be you can follow a combination of the following OBEs to insert BLOB data and send BLOB data from APEX:
http://www.oracle.com/technology/obe/apex/apex31nf/apex31blob.htm
http://www.oracle.com/technology/obe/apex/apex31nf/apex31email.htm
-Priyanka -
Inserting Blob in PL/SQL using select from other table
Oracle 11.1.7.0:
I am trying to insert blob column as defined below but not able to. Is this the right way of inserting blobs?
set serveroutput on
spool a.dat
DECLARE
BEGIN
for i in 1..2
loop
for j in (select r_payload
from fp_data where payload_id=331525112)
loop
EXECUTE IMMEDIATE 'insert into fp_data (r_payload) values ( ' || j.r_payload || ')';
end loop;
end loop;
rollback;
END;
exit;BLOB work same a CLOB
SQL> @clob
SQL> drop table toto;
SQL> create table toto (
2 A VARCHAR2 (30) NOT NULL,
3 B VARCHAR2 (30) NOT NULL,
4 C clob default empty_clob()
5 )
6 lob(c) store as toto_name_lo(disable storage in row)
7 ;
SQL>
SQL> set feedback off
SQL> set timing on;
SQL> prompt
SQL> prompt Insert lob with enabled storage in row:
Insert lob with enabled storage in row:
SQL> insert into toto (a, b, c)
2 select owner a, object_name b, owner || ' ' || object_name c from all_objects
3 where rownum < 10
4 ;
Elapsed: 00:00:00.51
SQL> set timing off;
SQL> select a,b from toto;
A B
SYS ICOL$
SYS I_USER1
SYS CON$
SYS UNDO$
SYS C_COBJ#
SYS I_OBJ#
SYS PROXY_ROLE_DATA$
A B
SYS I_IND1
SYS I_CDEF2
SQL> drop table fp_data;
SQL> create table fp_data (r_payload clob);
SQL> insert into fp_data select c from toto where a = 'SYS' AND B = 'I_IND1';
SQL> select count(*) from fp_data;
COUNT(*)
1no need for PL/SQL -
Inserting a blob in the table through java or Oracle ApplicationFramework
I am new to Oracle framework. I have a requirement to insert one file(i.e blob) into the database from custom location.(ie.D:\sample.txt). through java or OAF. But i am unable to insert the file. Is there any specific function to insert blob fields in the database...........
Did you take a look at
<JDEV_CLIENT_INSTALL_DIR>\jdevdoc\devguide\feat\feat_fileload.htm -
How to insert images in a table
Hi all,
Iam working On Oracle10g
can any one explain how to insert images in a table.
Any help will be much appreciated!!
Thanks.Hi,
Try like this
step1: Create a folder & place the image in it.
for eg: place the image 'Sunset.jpg' in 'IMAGEFILE' folder of D drive
Step2: Create a Directory in sql*plus as
CREATE DIRECTORY IMAGEDIR AS 'D:\IMAGEFILE';
Step3: Grant previlage to user
GRANT READ ON DIRECTORY IMAGEDIR TO PUBLIC;
Step4: Create the table in which you want to insert the image
create table loadalbum
(name varchar2(100),
image blob)
Step5: Create the procedure as
declare
l_blob blob;
l_bfile bfile;
begin
insert into loadalbum values ( 'Sunset', EMPTY_BLOB() )
returning image into l_blob;
l_bfile := bfilename( 'IMAGEDIR', 'Sunset.jpg');
dbms_lob.fileopen( l_bfile );
dbms_lob.loadfromfile( l_blob, l_bfile, dbms_lob.getlength( l_bfile ) );
dbms_lob.fileclose( l_bfile );
end;
Now you can know whether the image is inserted or not by
SELECT COUNT(*) FROM LOADALBUM;
COUNT(*)
1
which means image is inserted.
Hope this may help you. -
How to load blob data into table
hi
i have a table with
ID NUMBER No - 1
PARENT_ID NUMBER No - -
DOCUMENT BLOB Yes - -
NAME VARCHAR2(40) Yes - -
MIMETYPE VARCHAR2(40) Yes - -
COMMENTS VARCHAR2(400) Yes - -
TIMESTAMP_CREATED TIMESTAMP(6) Yes - -
CREATED_BY VARCHAR2(40) Yes - -
TIMESTAMP_MODIFIED TIMESTAMP(6) Yes - -
MODIFIED_BY CHAR(40) Yes - -
IS_GROUP CHAR(1) No - -
FILE_NAME VARCHAR2(4000) Yes - -
as columns. i want to insert blob data into the empty table.i have some fields in the form through which i insert data by hard coding in a process.when i upload a document in the filebrowse type field the mime type is not updating though i have written code in the source value. i removed the database links of the form with the table and that is why i am hard coding to the table thru a process. could u suggest a query where i can insert the blolb data.
i use the process
begin
select max(ID) into aaa from "PSA_KNOWLEDGE_TREE";
insert into PSA_KNOWLEDGE_TREE values(aaa+1,1,null,:p126_NEW_GROUP,null,:p126_COMMENTS,:P126_TIMESTAMP_CREATED,:P126_CREATED_BY,null,null,'Y',null);could u please type the query according to my table and process requirements. i have tried many queries and i have failed to load the blob data. the imetype is not being updated.
thnx for ur reply -
How to move BLOBs from one table to another ??
Hi All,
I am trying to move blobs from one table to another, however my insert statement is not working. What i mean is its running, but records are not being inserted into the table.
This is my first time moving blobs, so please bear with me.
here is my insert statement:
INSERT INTO CASES.FILESTORAGE
SELECT DID,
DRENDITIONID,
DLASTMODIFIED,
DFILESIZE,
DISDELETED,
BFILEDATA // this attribute is the BLOB
FROM USSC_CASES_TMP.FILESTORAGE
WHERE DID NOT IN (SELECT DID FROM CASES.FILESTORAGE);here is the DDL for the table.
CREATE TABLE "USSC_CASES_TMP"."FILESTORAGE"
"DID" NUMBER(*,0) NOT NULL ,
"DRENDITIONID" VARCHAR2(30 CHAR) NOT NULL ,
"DLASTMODIFIED" TIMESTAMP (6),
"DFILESIZE" NUMBER(*,0),
"DISDELETED" VARCHAR2(1 CHAR),
"BFILEDATA" BLOB,
CONSTRAINT "PK_FILESTORAGE" PRIMARY KEY ("DID", "DRENDITIONID")
);CASES.FILESTORAGE table has the same DDL, but in a different schema.
Thanks in advance.If this seems rather straight forward. If the schema are exact simply execute:
inset into [destination] select * from [source] ;if something is amiss you should be throwing errors someplace* but try this:
create table [scratch table name] as select * from [source table] where [place some limit here] ;If this does not work then something someplace is very wrong and if you are not the DBA you need to get this persons attention, fairly quickly. I would do the above from sqlplus and then after each statement would:
commit;then check to see if it succeeded. -
mod_plsql: ORA-942 Execute(Temp BLOB) ORA-00942: table or view does not exist
This is the error I get in the Apache log. On the page:
"The requested URL /pls/apex/wwv_flow.accept was not found on this server."
I am sure this is just a configuration issue. I installed v1.6 with the http server off the companion cd with the db (10.2.0.1). After I had it working (did not test everything) I upgraded to 3.0.1.
I get this message when I am trying to import an application that I just exported! I am testing this for pushing code up to our production environment.
My dads.conf file looks like:
Alias /i/ /oracle/product/apps/htmldb/images/
AddType text/xml xbl
AddType text/x-components htc
<Location /pls/apex>
SetHandler pls_handler
Order deny,allow
Allow from all
AllowOverride None
PlsqlDatabaseUsername APEX_PUBLIC_USER
PlsqlDatabasePassword xxxxxx
PlsqlDatabaseConnectString 192.168.2.195:1521:idpdev ServiceNameFormat
PlsqlDefaultPage apex
PlsqlDocumentTablename wwv_flow_file_object$
PlsqlDocumentPath docs
PlsqlDocumentProcedure wwv_flow_file_mgr.process_download
PlsqlAuthenticationMode Basic
PlsqlNLSLanguage AMERICAN_AMERICA.WE8ISO8859P1
</Location>
marvel.conf file is empty
There is a log file for pl/sql.... it has the following text in it that seemed pertinent: Attempting to logon with '(unknown)'
Also a log that says this and seems to have a "special character" in it that may be causing an issue:
<1133864024 ms>6565646261636b206f6e a70726f6d707420202e2e2e646f6e65 a
<1133864024 ms>-----------------------------2444716671664
<1133864024 ms>^M
<1133864024 ms>UploadBlobDoc: readahead 27 bytes into 82f5e5c
<1133864024 ms>UploadBlobDoc : Inserting piece OCI_NEXT_PIECE
<1133864024 ms>UploadBlobDoc:Attempt to write 2048 bytes(offset 249857)
<1133864024 ms>UploadBlobDoc:OCILobWrite for 2048 bytes (offset 249857)
<1133864024 ms>UploadBlobDoc: Read-Ahead buf 82f5e5c has 27 bytes
<1133864024 ms>UploadBlobDoc : Inserting piece OCI_LAST_PIECE
<1133864024 ms>UploadBlobDoc:Attempt to write 27 bytes(offset 251905)
<1133864024 ms>UploadBlobDoc:OCILobWrite finished for 27 bytes
<1133864024 ms>ORA-942 Execute(Temp BLOB) ORA-00942: table or view does not exist
<1133864024 ms>Stale Connection due to Oracle error 942
<1133864024 ms>/pls/apex/wwv_flow.accept HTTP-404 ORA-00942: table or view does not exist
<1133864024 ms>(wpu.c,594) longjumping back to the beginning
<1133864024 ms>(wpu.c,457) cleaning up before longjmp
<1133864024 ms>(wpu.c,461) doing a rollback
<1133864024 ms>(wpcs.c, 76) Executed 'rollback' (rc=0)
<1133864024 ms>(wpcs.c, 76) Executed 'begin dbms_session.reset_package; end;' (rc=0)
<1133864024 ms>(wpd.c,1816) Going to close cursor
<1133864024 ms>Freed BLOB
<1133864024 ms>DeinitCursor
<1133864024 ms>(wpx.c,690) Shutdown has been called
<1133864024 ms>(wpx.c,702) Going to logoff
<1133864024 ms>Logoff: Closing connection due to stale connection
<1133864034 ms>[ReqEndtime: 2/Oct/2007:15:38:11]
<1133864034 ms>[ReqExecTime: 80 ms]
I did go in and update the permissions to the wwv_flow_file_objects$ table to give PUBLIC full access to that table to see if that was the problem... it wasn't.
Probably information overload, but just wanted to be thorough. Anyone have any ideas?I also have another issue... probably more of a clarification....
I run the following to stop the process:
"/oracle/product/apps/opmn/bin/opmnctl stopproc ias-component=HTTP_Server"
then
"/oracle/product/apps/opmn/bin/opmnctl startproc ias-component=HTTP_Server"
But, at that point, it says that opmn is not running.
So I try:
"/oracle/product/apps/opmn/bin/opmnctl stopall"
then
"/oracle/product/apps/opmn/bin/opmnctl start"
then
"/oracle/product/apps/opmn/bin/opmnctl startproc ias-component=HTTP_Server" and it still says that opmn is not running.
Once I start running the stops and starts, it will eventually start correctly.
I think that I am trying the steps too fast and that I probably need to wait a bit between steps since that seems to work better that way. -
What is the best way to Insert BLOB in DB?
Hi,
We are having a Table containing BLOB datatype & trying to populate it using JDBC. But simple insert is not allowing us to insert the data into table. As the alternative we used to firstly insert a empty_blob & later on update it using FOR UPDATE query resultset. This update operation is quite costly for our application & thus resulting in the drop of performance. Kindly suggest a better way to do the operation in a less costly & standard way.
Thanks in advance.Ciao Giovanni,
I thank you for your reply. We are already using JDBC driver version 10.2. Please refer to the extract from the driver jar file (OJDBC14.jar):
Created-By: 1.4.2_08 (Sun Microsystems Inc.)
Implementation-Title: ojdbc14.jar
Specification-Vendor: Oracle Corporation
Specification-Version: Oracle JDBC Driver version - "10.2.0.1.0"
Implementation-Version: Oracle JDBC Driver version - "10.2.0.1.0"
Implementation-Vendor: Oracle Corporation
Implementation-Time: Wed Jun 22 11:19:45 2005
The insertion is done in two steps:
1. First , enter an empty blob (Refer to the following prepared statements in Java):
sFirst.setString(1, id);
sFirst.setInt(2, 0);
sFirst.setString(3, pid);
sFirst.setBlob(4, BLOB.getEmptyBLOB());
sFirst.execute();
2. Second, do a select for update
Please help.
Regards. -
RegisterOutParameter - setBinaryStream - Problems inserting Blob - setRAW
As posted in metalink (was: "Problems inserting BLOB/InputStream with ojdbc14.jar for 10g - Data size bigger than max size for this type"):
Using setBinaryStream for large Blobs works as long as I don't register outParameters.
Query that works: "INSERT INTO blobtest (attachment_id,name,data) VALUES(blobtest_SEQ.nextval,?,?)";
Query that fails = "BEGIN INSERT INTO blobtest (attachment_id,name,data) VALUES( blobtest_SEQ.nextval,?,?) RETURN attachment_id INTO ? ; END;"
The necessary tables were created by hand:
CREATE TABLE blobtest ( NAME CHAR(255), data BLOB, attachment_id NUMBER(38))
And
CREATE SEQUENCE TBL_ATTACHMENT_SEQ
The output was: <<user: SEE
pw: QD
instantiating oracle driver
query: INSERT INTO blobtest (attachment_id,name,data) VALUES(TBL_ATTACHMENT_SEQ.nextval,?,?)
uploaded no Return Parameter blob of size: 256809
query: BEGIN INSERT INTO blobtest (attachment_id,name,data) VALUES(TBL_ATTACHMENT_SEQ.nextval,?,?) RETURN attachment_id INTO ? ; END;
java.sql.SQLException: Datengr÷▀e gr÷▀er als max. Gr÷▀e f³r diesen Typ: 256809
at
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:125)
at
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:162)
at
oracle.jdbc.driver.OraclePreparedStatement.setRAW(OraclePreparedState
ment.java:5342)
at
oracle.jdbc.driver.OraclePreparedStatement.setBinaryStreamInternal(Or
aclePreparedStatement.java:6885)
at
oracle.jdbc.driver.OracleCallableStatement.setBinaryStream(OracleCall
ableStatement.java:4489)
at BlobTest.writeBlob(BlobTest.java:161)
at BlobTest.testBlob(BlobTest.java:118)
at BlobTest.main(BlobTest.java:92)
error: Datengr÷▀e gr÷▀er als max. Gr÷▀e f³r diesen Typ:
256809>>
here the java test case:
* Created on 25.08.2004 $Id: BlobTest.java,v 1.4 2005/04/22 11:21:11 hauser Exp $
* as posted in metalink jdbc forum 050405 and responses by
* [email protected]
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.Types;
public class BlobTest {
private static String FILE_NAME = "c:/temp/veryLargeFile.pdf";
public BlobTest() {
final static int ORACLE = 1;
final static int MYSQL = 2;
private String jdbcUrl = "jdbc:mysql://localhost/test?user=monty&password=greatsqldb";
private int dbType = ORACLE;
private Driver driver = null;
private String user = "";
private String pw = "";
public static String SCHEME = "";
public static void main(String[] args) {
BlobTest bt = new BlobTest();
if (args[0] != null) {
System.out.println("dbType: " + args[0]);
if (args[0].toLowerCase().indexOf("oracle") != -1) {
bt.dbType = ORACLE;
if (args[0].toLowerCase().indexOf("mysql") != -1) {
bt.dbType = MYSQL;
} else {
System.out.println("not yet supported db type: " + args[0]);
System.exit(99);
if (args[1] != null) {
System.out.println("jdbcUrl: " + args[1]);
if (args[1].trim().length() != 0) {
bt.jdbcUrl = args[1].trim();
} else {
System.out.println("not yet supported jdbcUrl : " + args[1]);
System.exit(99);
if (args.length > 2 && args[2] != null) {
System.out.println("user: " + args[2]);
if (args[2].trim().length() != 0) {
bt.user = args[2].trim();
} else {
System.out.println("invalid user: " + args[2]);
System.exit(99);
if (args.length > 3 && args[3] != null) {
System.out.println("pw: " + args[3].substring(0, 2));
if (args[3].trim().length() != 0) {
bt.pw = args[3].trim();
} else {
System.out.println("invalid filename: " + args[3]);
System.exit(99);
if (args.length > 4 && args[4] != null) {
System.out.println("filename: " + args[4]);
if (args[4].trim().length() != 0) {
FILE_NAME = args[4].trim();
} else {
System.out.println("invalid filename: " + args[4]);
System.exit(99);
bt.setUp();
bt.testBlob();
public void setUp() {
try {
if (this.dbType == ORACLE) {
System.out.println("instantiating oracle driver ");
this.driver = (Driver) Class.forName(
"oracle.jdbc.driver.OracleDriver").newInstance();
} else {
this.driver = (Driver) Class.forName("com.mysql.jdbc.Driver")
.newInstance();
if (this.driver == null) {
System.out.println("oracle driver is null");
System.exit(88);
DriverManager.registerDriver(this.driver);
} catch (Exception e) {
e.printStackTrace();
System.out.println("error: " + e.getMessage());
public void testBlob() {
try {
this.writeBlob();
} catch (Exception e) {
e.printStackTrace();
System.out.println("error: " + e.getMessage());
* testfunction
private void writeBlob() throws Exception {
Connection conn = null;
PreparedStatement pStmt = null;
CallableStatement cStmt, cStmt2 = null;
InputStream in = null;
try {
File file = new File(BlobTest.FILE_NAME);
in = new FileInputStream(file);
conn = DriverManager.getConnection("jdbc:" + this.jdbcUrl,
this.user, this.pw);
conn.setAutoCommit(false);
String queryWorks = "INSERT INTO " + SCHEME
+ "blobtest (attachment_id,name,data) VALUES(" + SCHEME
+ "TBL_ATTACHMENT_SEQ.nextval,?,?)";
cStmt = conn.prepareCall(queryWorks);
System.out.println("query: " + queryWorks);
cStmt.setString(1, file.getAbsolutePath());
in = new FileInputStream(file);
cStmt.setBinaryStream(2, in, (int) file.length());
cStmt.execute();
System.out.println("uploaded no Return Parameter blob of size: "
+ file.length());
conn.commit();
String queryFails = "BEGIN INSERT INTO " + SCHEME
+ "blobtest (attachment_id,name,data) VALUES(" + SCHEME
+ "TBL_ATTACHMENT_SEQ.nextval,?,?)"
+ " RETURN attachment_id INTO ? ; END;";
cStmt2 = conn.prepareCall(queryFails);
System.out.println("query: " + queryFails);
cStmt2.setString(1, file.getAbsolutePath());
in = new FileInputStream(file);
cStmt2.setBinaryStream(2, in, (int) file.length());
cStmt2.registerOutParameter(3, Types.INTEGER);
cStmt2.execute();
System.out.println("uploaded blob of size: " + file.length()
+ " - id: " + cStmt2.getInt(3));
conn.commit();
} catch (Exception e) {
e.printStackTrace();
System.out.println("error: " + e.getMessage() + "\nname: "
+ BlobTest.FILE_NAME);
if (conn != null) {
try {
conn.rollback();
} catch (Exception e1) {
throw e;
} finally {
if (in != null) {
try {
in.close();
} catch (Exception e) {
if (pStmt != null) {
try {
pStmt.close();
} catch (Exception e) {
if (conn != null) {
try {
conn.close();
} catch (Exception e) {
and the batch file I use to start:
@setlocal
@echo off
rem $Id: runBlobTest.bat,v 1.2 2005/04/21 15:06:22 hauser Exp $
set classpath=../WEB-INF/classes;../WEB-INF/lib/ojdbc14.jar;
echo JAVA_HOME: %JAVA_HOME%
set JAVA_HOME=C:\PROGRA~1\Java\j2re1.4.1_02\
echo classpath: %classpath%
set javaCmd=C:\PROGRA~1\Java\j2re1.4.1_02\bin\java
%javaCmd% -version
%javaCmd% BlobTest "oracle" "oracle:thin://@ORADB.yourdomain.COM:1521:t300" "username" "password" "C:\Temp\veryLargeFile.pdf"
endlocalApparently, this is partially known - with a different stacktrace though:
<<From: Oracle, Anupama Srinivasan 25-Apr-05 07:15
Can you please check on Bug:4083226?
Using the RETURNING Clause is not supported with JDBC. You could embed the statement in PL/SQL Block as in Metalink Note 124268.1 - JDBC Support for DML Returning Clause.
The Enhancement Request filed on this issue is being considered for Release 10.2
>>
And my answer to it.
Using the RETURNING Clause is not supported with JDBC.This is strange, with just "emptyblob()", it DOES work.
I guess, our work-around that hopefully is more portable than embedding a "PL/SQL Block" will be to
1) create the record with an empty blob,
2) update the blob in a second statement (now, a RETURNING statement is no longer needed) -
Inserting data into one table using another table
Hi i have 2 tables
CREATE TABLE N_SET
N_ST_ID NUMBER(38) NOT NULL, ---- PK
N_ST_NM VARCHAR2(50 BYTE) NOT NULL,
N_ST_DSC VARCHAR2(200 BYTE),
DFTID NUMBER ------ FK
CREATE TABLE RZ
NST_ID NUMBER(38) NOT NULL, ---- FK
RID NUMBER(38) NOT NULL, --- PK
RNM VARCHAR2(30 BYTE) NOT NULL
I entered the data into the N_SET table using sequence in column N_ST_ID (using procedure)
Now i need to enter the data into RZ table where NST_ID should contain the value of N_SET.N_ST_ID
so for this i've written another procedure
but confused how to write the select statement to retrieve the above condition..
Could you help me in this please...Hi,
I have a table Target whose structure is
create table employee
id VARCHAR2(20),
name VARCHAR2(20),
employee_seq NUMBER not null
-- Create sequence
create sequence test_seq
minvalue 1
maxvalue 999999999999999999999999999
start with 5
increment by 1
nocache
cycle;
create table emp
id VARCHAR2(20)
name VARCHAR2(20)
INSERT INTO emp
( id, name )
VaLUES ( '100','test1');
commit;
INSERT INTO emp
( id, name )
VaLUES ( '100','test2');
commit;
i have to insert into the TARGET table the fsa value from
SOURCE table along with the sequence number using sequence test_seq.nextval.
INSERT INTO employee
( id, name, employee_seq )
SELECT id, ename, ( select test_seq.nextval from dual )
FROM emp ; -
Inserting data from one table into another table using PL/SQL
HI,
I am trying to insert values from one table into another using PL procedure, the values I want to retrieve from the table riverside1 are charac_id and charac_type and insert these values into another table called riverside2 , the stored procedure zorgs_gorfs(x,y) accepts two parameters which are 2 charac_id's of d characters in riverside1 then using insert statements inserts these characters from riverside1 into riverside2.
CREATE OR REPLACE PROCEDURE zorgs_gorfs(x IN NUMBER, y IN NUMBER) AS
BEGIN
INSERT INTO riverside2
(charac_id)
VALUES
(x);
INSERT INTO riverside2
(charac_id)
VALUES
(y);
END zorgs_gorfs;
/This works but the problem im having is that when I also try to insert the charac_type as well as the charac_id it doesnt work below is the code:
CREATE OR REPLACE PROCEDURE zorgs_gorfs(x IN NUMBER, y IN NUMBER) AS
BEGIN
INSERT INTO riverside2
(charac_id,charac_tye)
VALUES
(Select
charac_id,
charc_type
FROM
riverside1
WHERE
charac_id = x);
END zorgs_gorfs;
/can someone kindly sort me outmodify this sql
INSERT INTO riverside2
(charac_id,charac_tye)
VALUES
(Select
charac_id,
charc_type
FROM
riverside1
WHERE
charac_id = x);as
INSERT INTO riverside2
(charac_id,charac_tye)
VALUES
(Select
charac_id,
charc_type
FROM
riverside1
WHERE
charac_id in ( x,y));But my suggestion would be consider revising your approach. It does not look that good.
Thanks,
karthick. -
CMP insert failure using secondary table
I've defined a CMP with a column from a secondary table.
The retrieval/updates work fine, but I'm getting a failure
on insert. It's trying to insert a duplicate primary key into the secondary table. I do NOT want to insert into the secondary table when I insert into the primary table. I just want to retrieve data from that table on findByPrimaryKey from the
primary table. Is there any way to do this??How can you retrieve from the secondary table w/o inserting into it? Can you send me your table definition? What error do you get?
-
I wish to insert data into a table only when the value of the inserted data has changed. Thus, in a time series, if the value of the data at time, t-1, is 206 then if the data to be inserted at time t is 206, then it is skipped (not entered).
If the value of the data at time t+1 is 206, it is skipped also; until the value changes, so if the value at t+1 was 205, then that would be inserted, and if at time t+2 the data is 206, it would be inserted too.
What is the best way to do it without increasing overheads?This view works:
SELECT
i.IDNO,i.[Date],i.[Level]
FROM
mytable i
INNER
JOIN mytable
d
ON
d.IDNO
= i.IDNO-1
WHERE
i.[Level]
<> d.[Level]
on this mytable below. A trigger could be quite useful here although I am cautious using them. However I wish to avoid the overhead by not having a temp table (which could be sizable). mytable below
should give 3 lines. The IDNO is an identity column.
IDNO
Item
Date
Level
1
X24
12/23/13 10:41
22996
2
X24
12/23/13 10:41
22996
3
X24
12/23/13 9:21
23256
4
X24
12/23/13 9:21
23256
5
X24
12/23/13 9:22
23256
6
X24
12/23/13 9:22
23256
7
X24
12/23/13 9:22
22916
Maybe you are looking for
-
Good Morning All, I'm working on developing a cube that measure's budget and actual cost for a customer that I'm working with. We have serveral dimensions that comes into play: Organization - this dimension defines the various internal departments a
-
Writing to file on server from applet
ok i know this issue has been dealt with on numerous occasions but i would like someone to explain me in details what would be the best way of doing it. I know that one way of doing it is having a servlet which would perform I/O and would communicate
-
Muse published to BC - BC synching to Muse problems
We have a problem with a Muse site that has been published to Business Catalyst. http://www.parkerandassociates.co.nz/ The client needs to access the File Manager which by default with Muse is not enabled, so in order to allow this the setting 'Enabl
-
Start screen does not exist in batch input data
I'm using .NET Connector calling Rfc_Call_Transaction funtion throught a proxy, i stablished all the params as you can see in the code below, but i get the message cited in the subject 'Start screen does not exist in batch input data'. What do you th
-
I Can't Put Songs Onto My iPod
Hey, I have 697 songs currently on my library, when I connect my iPod to the computer it says it's retrieving less songs than that, say 200 for example, which it doesn't do anyway. It just sits there not putting any songs onto my iPod and then comes