Insert 3 blanks in a database through form
hello everybody,
My query is when i assign balnks to a field like :fieldname =' ' then form makes it null & insert nulls in db is there any way to do this instead of writting On-insert trigger & whole insert statement in it.
Regards
I offered him, that I'll leave company, then there
was peace and clear mind back.:-) well... I wouldn't threaten to quit instead of inserting blanks into a database field (the boss might take me up on it), but it is certainly not a good idea.
But there is no way in forms to insert blanks into a column on the database without writing some pl/sql code to do it.
Similar Messages
-
Store and display word document in database through forms
how can i store a word document in database through forms 6i or 10g, and display it through forms from database.
i know how to store a binary file in database through DBMS_LOB package, but i want to do it throug forms. is it possible?
regardsHi Alex
"Create a datablock and specify the item datatype as blob"
BUT: How to bring the document to the blob?
Hi user 611..
Warning: It is easy if you use an OLE-Object - but OLE is a special format. The result will not be the same as with dbms_LOB.
We have a application with documents stored via OLE - terrible!
OLE is no longer supported by forms 10. But webutil would help.
I asked a similar question and got a good answer:
OLE-Container and migration to the web
Wolfram -
Open word file, stored in database through Forms.
Assalam-o-Alikum
to Genius of Oracle's
I have stored the Word file name "MY_FILE.DOC" in oracle database. Now i want to open the file through Forms, remember i am using forms 6i. is there any body who help me to open the file.
Best Regards
Farrukh ShaikhAssalam-o-Alikum
My in tension was not to hurt any body. if it did then sorry for that.
here is the code through which i stored the file in database
first create the DIRECTORY CREATE DIRECTORY generic AS 'C:\temp';---- --directory path where your files will be searched for storing.
THEN
create table my_blob_table
pk_name varchar2(20) primary key,
pk_value varchar2(20),
col_document blob
INSERT INTO MY_BLOB_TABLE
(PK_NAME,PK_VALUE)
('A','A');
COMMIT;
CREATE OR REPLACE PROCEDURE load_blob_from_file
( src_file_name IN VARCHAR2
, table_name IN VARCHAR2
, column_name IN VARCHAR2
, primary_key_name IN VARCHAR2
, primary_key_value IN VARCHAR2 ) IS
-- Define local variables for DBMS_LOB.LOADBLOBFROMFILE procedure.
des_blob BLOB;
src_blob BFILE := BFILENAME('GENERIC',src_file_name);
des_offset NUMBER := 1;
src_offset NUMBER := 1;
-- Define a pre-reading size.
src_blob_size NUMBER;
-- Define local variable for Native Dynamic SQL.
stmt VARCHAR2(2000);
BEGIN
-- Opening source file is a mandatory operation.
IF dbms_lob.fileexists(src_blob) = 1 AND NOT dbms_lob.isopen(src_blob) = 1 THEN
src_blob_size := dbms_lob.getlength(src_blob);
dbms_lob.open(src_blob,DBMS_LOB.LOB_READONLY);
278 Oracle Database 11g PL/SQL Programming
END IF;
-- Assign dynamic string to statement.
stmt := 'UPDATE '||table_name||' '
|| 'SET '||column_name||' = empty_blob() '
|| 'WHERE '||primary_key_name||' = '||''''||primary_key_value||''' '
|| 'RETURNING '||column_name||' INTO :locator';
-- Run dynamic statement.
EXECUTE IMMEDIATE stmt USING OUT des_blob;
-- Read and write file to BLOB.
dbms_lob.loadblobfromfile( dest_lob => des_blob
, src_bfile => src_blob
, amount => dbms_lob.getlength(src_blob)
, dest_offset => des_offset
, src_offset => src_offset );
-- Close open source file.
dbms_lob.close(src_blob);
-- Commit write.
IF src_blob_size = dbms_lob.getlength(des_blob) THEN
$IF $$DEBUG = 1 $THEN
dbms_output.put_line('Success!');
$END
COMMIT;
ELSE
$IF $$DEBUG = 1 $THEN
dbms_output.put_line('Failure.');
$END
RAISE dbms_lob.operation_failed;
END IF;
END load_blob_from_file;
after create the PROCEDURE run the procedure
begin
load_blob_from_file('FILE_NAME.DOC',' my_blob_table','col_document','PK_NAME','A');
end; -
How Insert the input parameter to database through Java Bean
Hello To All..
I want to store the input parameter through Standard Action <jsp:useBean>.
jsp:useBean call a property IssueData. this property exist in
SimpleBean which create a connection from DB and insert the data.
At run time when I click on submit button servlet and server also show that loggging are saved in DB.
But when I open the table in Access. Its empty.
Ms-Access have two fields- User, Pass both are text type.
Please review these code:
login.html:
<html>
<head>
<title>A simple JSP application</title>
<script language=javascript>
function f(k)
document.forms['frm'].mykey.value=k;
document.forms['frm'].submit();
</script>
<head>
<body>
<form method="get" action="tmp" name="frm">
Name: <input type="text" name="User">
Password: <input type="password" name="Pass">
<input type=hidden name="mykey" value="">
<input type="button" value="Submit" onclick="f('submit.jsp')">
<input type="button" value="Issue" onclick="f('issue.jsp')">
</form>
</body>
</html>LoginServlet.java:import javax.servlet.*;
import javax.servlet.http.*;
public class LoginServlet extends HttpServlet{
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException{
try
String User=request.getParameter("User");
String Pass=request.getParameter("Pass");
co.SimpleBean st = new co.SimpleBean();
st.setUser(User);
st.setPass(Pass);
request.setAttribute("User",st);
request.setAttribute("Pass",st);
RequestDispatcher dispatcher1 =request.getRequestDispatcher("/"+request.getParameter("mykey"));
dispatcher1.forward(request,response);
catch(Exception e)
e.printStackTrace();
}SimpleBean.java:package co;
import java.util.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.util.*;
public class SimpleBean
private String User="";
private String Pass="";
private String s="";
public SimpleBean(){}
public String getUser() {
return User;
public void setUser(String User) {
this.User = User;
public String getPass() {
return Pass;
public void setPass(String Pass) {
this.Pass = Pass;
public String getissueData() //method that create connection with database
try
System.out.println("Printed*************************************************************");
getUser();
getPass();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
System.out.println("Loading....");
Connection con=DriverManager.getConnection("jdbc:odbc:simple");
System.out.println("Connected....");
PreparedStatement st=con.prepareStatement("insert into Table1 values(?,?)");
System.out.println("~~~~~~~~~~~~~~~~~~~~");
String User=getUser();
st.setString(1,User);
String Pass=getPass();
st.setString(2,Pass);
int y= st.executeUpdate();
System.out.println(y);
System.out.println("Query Executed");
con.commit();
con.close();
s= "Your logging is saved in DB ";
System.out.println("Your logging is saved in DB *****************");
return this.s;
catch(Exception e)
e.printStackTrace();
return "failed";
}submit.jsp:
This is Submit page
<html><body>
Hello
Student Name: <%= ((co.SimpleBean)request.getAttribute("User")).getUser() %>
<br>
Password: <%= ((co.SimpleBean)request.getAttribute("Pass")).getPass() %>
<br>
<jsp:useBean id="st" class="co.SimpleBean" scope="request"/>
<jsp:setProperty name="st" property="User" value="request.getParamaeter("Pass")"/>
<jsp:setProperty name="st" property="Pass" value="request.getParamaeter("Pass")"/>
<jsp:getProperty name="st" property="issueData"/>
<% st.getissueData(); %>
</body></html>web.xml:<web-app>
<servlet>
<servlet-name>one</servlet-name>
<servlet-class>LoginServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>one</servlet-name>
<url-pattern>/tmp</url-pattern>
</servlet-mapping>
<jsp-file>issue.jsp</jsp-file>
<jsp-file>submit.jsp</jsp-file>
<url-pattern>*.do</url-pattern>
<welcome-file-list>
<welcome-file>Login.html</welcome-file>
</welcome-file-list>
</web-app>Please Help me..Dear Sir,
Accordingly your suggestion I check the SimpleBean class putting the constant values in this bean class.That is Sucessfully Inserted constant values in database.
Like for example..
myfirstjavabean.java:
package myfirstjava;
import java.io.*;
import java.sql.*;
public class myfirstjavabean
private String firstMsg="Hello world";
private String s="";
public myfirstjavabean()
public String getfirstMsg()
return firstMsg;
public void setfirstMsg(String firstMsg)
this.firstMsg=firstMsg;
public String getissueData() //method that create connection with database
try
System.out.println("Printed*************************************************************");
getfirstMsg();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
System.out.println("Loading....");
Connection con=DriverManager.getConnection("jdbc:odbc:sampleMsg");
System.out.println("Connected....");
PreparedStatement st=con.prepareStatement("insert into Table1 values(?)");
System.out.println("~~~~~~~~~~~~~~~~~~~~");
String Msg=getfirstMsg();
st.setString(1,Msg);
int y= st.executeUpdate();
System.out.println(y);
System.out.println("Query Executed");
con.commit();
con.close();
s= "Your logging is saved in DB ";
System.out.println("Your logging is saved in DB *****************");
return this.s;
catch(Exception e)
e.printStackTrace();
return "failed";
}Vij.jsp:
<html>
<body>
<jsp:useBean id="st" class="myfirstjava.myfirstjavabean" scope="request" />
<jsp:getProperty name="st" property="firstMsg" />
<jsp:getProperty name="st" property="issueData" />
</body>
</html>These above example sucessfully inserted the Hello World message in database.
But which value I put user input at run time Its not inserted in database.
Which is my previous problem that is persist.
Please Help.. -
Connect to Database through FORM builder
I have configured 2 listeners to my database, both connect to the database ok but when I try to connect through my form builder I keep getting the error message
"cannot resolve service_name" even though it's already connected through my net configuration assistant. Is there a seperate connect properties file for my form builder?You need to add an entry in the tnsnames.ora file that is in the Oracle_home that Forms is in.
-
Storing a file in a BLOB field in the database through forms
Hi, I want to have a form that lets the user choose a file he has on his client side and load this file into a BLOB field in the database.
I know how to use "GET_FILE_NAME" to get the file, the second part is what I'm having problems with. Do I use an OLE object? How do I initailize it? Or what is the best way to go? Thanks.
--BassemAre you looking for something like this?
DECLARE
l_temp clob;
l_text varchar2(2000);
BEGIN
l_temp := httpuritype('http://www.oracle.com/PO.xsd').getclob;
l_text := substr(l_temp, 1, 2000);
dbms_output.put_line(l_text);
END;N.B.: Not Tested...
Regards.
Satyaki De. -
How can i save and retrieve blob data through forms and reports...
I have blob data type column and I want to save word, html, gif
document in oracle database through forms 6 and retrieve the
data into forms and reports.
Details : I want to open .doc,.html,.gif file through a button
and save it ..and i want retrieve the data into text item same
in reports....
If anybody have the answer then send me at
[email protected]use ole container
initialize the container with the filename (doc or gif)
Edited by: arshid on Feb 8, 2009 1:57 PM -
Unable to Connect to Database from Forms/Reports 6i
I can't find anything wrong with my TNSNAMES.ORA file, yet I can't connect to my database through forms or reports.
The errors I keep getting is TNS-12154 and TNS-12203. Please advise. Thanks in advance.
E<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Mrs. Houser:
I can't find anything wrong with my TNSNAMES.ORA file, yet I can't connect to my database through forms or reports.
The errors I keep getting is TNS-12154 and TNS-12203. Please advise. Thanks in advance.
E<HR></BLOCKQUOTE>
Did you literally go into your tns file and put all of your specific envirnmental specifications?
Is the listener up and running?
Are you using the right alias?
Hope this helps.
null -
How do i insert into table through forms
Hi
I have developed a custom form based on custom table.
the only way to insert data into database table is through form.
there are two tables: one table is to store all contract details & second table is to maintain history forthis.
one condition(col1,col2,col3,col4) are unique combination,we are not creating any PK or FK at database level.evrythng is captured at form level.
if all 4 columns combination exist thn e should not insert that record.
if 4 columns combination doesnot exist then insert into table.
I have used just pre insert,pre update triggers.
I think its a basic form functionality ,by itself it inserts ,update record.now it is doing the same thng.
But I have to add the above condition ,how can i do that.
Pl provide me some ex code .
Thank you.
Hope any one can help meSQL> create table t
2 (object_id number
3 ,object_name varchar2(30));
Table created.
SQL>
SQL> create sequence t_seq;
Sequence created.
SQL>
SQL> insert into t (object_id, object_name)
2 select t_seq.nextval
3 ,object_name
4 from all_objects
5 ;
52637 rows created. -
Hashtable for multi part form to insert image and details to database:)
Hey guys do you have any samples on using hashtable in multipart form to insert image as well as details into database?:)
Oh it is because my form is using multipart from that enbales me to upload/Insert image into my database.
Howerver, I also need to insert other details into my database such as productid, ProdName, unitprice.....
Hence, My tutor suggested using hashtable.
However, I do not understnd.
Do you guys have any samples regarding on this?
Thanks
:DCathy_Latte wrote:
However, I do not understnd. More specifically: you do not understand how to use Maps? If so, just go through a book/tutorial on that subject. In fact you should have consulted your tutor or classmates for more information and you're here at a JSP/JSTL forum at the wrong place (you have a problem with Java in general, not with JSP), but OK, here's a link: [http://google.com/search?q=hashmap+tutorial+site%3Asun.com]. -
How to connect a PDF form to SQL server database through web service?
Hi,
I'm new to LiveCycle designer. I have designed a PDF form in LC designer ES2, which suppose to take a personnel number and retrieve the personnel information from a SQL server database. Currently its working fine with XML data and a search button, but I need to securly connect to a database through web service. I know how to connect to a wsdl file through designer. What I need is a wsdl file to connect the form to database. For this purpose, is there any WSDL code to use as the web service?
I really appreciate your help and advice.Hi,
I'm new to LiveCycle designer. I have designed a PDF form in LC designer ES2, which suppose to take a personnel number and retrieve the personnel information from a SQL server database. Currently its working fine with XML data and a search button, but I need to securly connect to a database through web service. I know how to connect to a wsdl file through designer. What I need is a wsdl file to connect the form to database. For this purpose, is there any WSDL code to use as the web service?
I really appreciate your help and advice. -
Inserting files in to Oracle 8i database through JDBC - Only 4k data file
Hi,
I need to insert a files(images or excel files, doc files etc..) in to oracle 8i database through JDBC program. But i am not able to store more than 4k data files in to files. can any body give me solutions regarding this.
My code is like this...
String fileName ="Sample.jpg";
String dataSource = "jdbc/oracle";
File file=null;
FileInputStream fis = null;
Context initCtx=null;
DataSource ds = null;
Connection con = null;
try
initCtx = new InitialContext();
ds = (DataSource)initCtx.lookup(dataSource);
con = ds.getConnection();
try
file = new File(fileName);
fis = new FileInputStream(file);
catch(FileNotFoundException fe)
out.println("File Not Found");
PreparedStatement pstmt = con.prepareStatement("insert into bfiles values(?,?)");
pstmt.setString(1, fileName);
pstmt.setBinaryStream(2, fis, (int)file.length());
pstmt.executeUpdate();
out.println("Inserted");
fis.close();
pstmt.close();
con.close();
out.println("closed");
catch(Exception e)
out.println(e);
} in Oracle bi i have created a table like this :
CREATE TABLE BFILES
FILENAME VARCHAR2(100) DEFAULT NULL,
FILECONTENT BLOB DEFAULT EMPTY_BLOB()
)Please help me ourt to solve this problem.
i got struck in this problem.
its urgent
thanks in advance
djshivuHi Shanu.
Thanks for your help...
By Using THIN driver also we can insert any files more than 4k and and retrive same. Fallowing codes worked fine for me using thin Driver .
Following are the 2 programs to write and read.
we can insert and retrieve any format of files ( jpg, gif, doc, xsl, exe, etc...)
=======================================================
// Program to insert files in to table
import oracle.jdbc.driver.*;
import oracle.sql.*;
import java.sql.*;
import java.io.*;
import java.awt.image.*;
import java.awt.*;
* @author Shivakumar D.J
* @version
public class WriteBlob{
public static void main(String[] args){
String filename = "018-Annexure-A.xls";
Connection conn = null;
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
conn=DriverManager.getConnection("jdbc:oracle:thin:@test:1521:orcl","modelytics","modelytics");
conn.setAutoCommit(false);
Statement st = conn.createStatement();
int b= st.executeUpdate("insert into bfiles values('"+filename+"', empty_blob())");
ResultSet rs= st.executeQuery("select * from bfiles for update");
rs.next();
BLOB blob=((oracle.jdbc.driver.OracleResultSet)rs).getBLOB(2);
FileInputStream instream = new FileInputStream(filename);
OutputStream outstream = blob.getBinaryOutputStream();
int chunk = blob.getChunkSize();
byte[] buff = new byte[chunk];
int le;
while( (le=instream.read(buff)) !=-1)
outstream.write(buff,0,le);
instream.close();
outstream.close();
conn.commit();
conn.close();
conn = null;
System.out.println("Inserted.....");
catch(Exception e){
System.out.println("exception"+e.getMessage());
e.printStackTrace();
}//catch
}=======================
// Program to retrieve files from database
[import java.sql.*;
import java.io.*;
import java.awt.*;
public class ReadImage
public static void main(String a[])
String fileName ="018-Annexure-A.xls";
try
Driver driver = new oracle.jdbc.driver.OracleDriver();
DriverManager.registerDriver(driver);
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@test:1521:orcl", "modelytics", "modelytics");
File file = new File("C:/Documents and Settings/USERID/Desktop/dump.xls");
FileOutputStream targetFile= new FileOutputStream(file); // define the output stream
PreparedStatement pstmt = con.prepareStatement("select filecontent from bfiles where filename= ?");
pstmt.setString(1, fileName);
ResultSet rs = pstmt.executeQuery();
rs.next();
InputStream is = rs.getBinaryStream(1);
byte[] buff = new byte[1024];
int i = 0;
while ((i = is.read(buff)) != -1) {
targetFile.write(buff, 0, i);
System.out.println("Completed...");
is.close();
targetFile.close();
pstmt.close();
con.close();
catch(Exception e)
System.out.println(e);
}====================
Table Structure is like this
CREATE TABLE BFILES
FILENAME VARCHAR2(100) DEFAULT NULL,
FILECONTENT BLOB DEFAULT EMPTY_BLOB()
)========================================================
i hope above codes will helpful for our future programmers
thanks shanu...
regards
djshivu...(javashivu) -
Is there any way to insert a blank line into a form? The only thing I can think of is to insert an empty display as text item with no label.
Is there an easier way?Hello,
Playing with the cell height, in the HTML Table Cell Attributes – like style="height:50px" – and with the Horizontal / Vertical Alignment of the label and element, can produce whatever space you need between your form elements.
Regards,
Arie.
Message was edited by:
ageller1 -
Inserting ordimage in database through jdbc
I want to insert an image of type ordimage to database through jdbc but not finding to which jdbc type i should map this when setting parameter in callableStatement. Kindly help me.
Hi,
There is a [url http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10779/toc.htm]specific Java API for the multimedia types (of which ORDIMAGE is one).
John -
Insert multiple records into database through internal table
Hi
please help me how to insert multiple records into database through internal tableHi,
Welcome to SCN.
Press F1 on INSERT statement and you will teh syntax as well the docu for the same.
Maybe you are looking for
-
Animated Gif- want to loop some frames, then others
I'm creating some web banners, and I need the file size to stay low, but would like to have a 3 or 4 frame cycle loop for a while, then go to a frame that holds for several seconds, then back to the loop, and then another frame that holds. So really
-
How to install CC Photoshop/Lightroom 5 to MAC
I purchased the one year CC for Photographers last week and I have not been able to install the Photoshop or Lightroom 5 to my MAC. When I go through the download process I keep on getting and ERROR, which says: Exit Code:7 Please see specific errors
-
Image stored in BLOB column crashes report's engine
Hi, I have a report where I display logos stored in a BLOB column on the DB. The report is generated as RTF. When images have sizes of 624x168 or 423x324 everything is OK. One image, 1221x224, is crashig the report with a dr. Watson error. Any idea w
-
I Am from Brasil and december last year i bought a non contract iphone in usa but it still locked, now apple is sending non contract unlocked iphone, next week i am going to usa and would like to know if it is possible to pay and unlock my iphone in
-
What is the best laptop or desktop to make and record music on?
i'm a muscian and heard mac is great to record on and they all come with garageband recording studio. is their a perticular one thats perfect for recording? and can i customize one for making music if they allready dont have one? thank you.