How to insert records into a table from a button?
Hey,.
I use Oracle form and I have a trigger button when button pressed.
I have a project being given for one of my classes. Basically, I have a Customers table and they hit the news. When they press submit, it must insert it into the table.
And here is the code I wrote to be inserted inside the button
declare
v_cust_id customer_detail.customer_id%type;
v_f_name customer_detail.fname%type;
v_l_name customer_detail.lname%type;
v_destination customer_detail.destination%type;
v_travel_date customer_detail.travel_date%type;
v_address customer_detail.address%type;
v_telephone customer_detail.telephone%type;
Start
insert into customer_detail
values (v_customer_id, v_fname, v_l_name, v_destination, v_travel_date, v_address, v_telephone);
end;
/
But its gives me an error. Is a PLsql Oracle form different syntax?
Why do you need to insert in the command, when applications oracle has this native features?
Make a form based on the table and just use
COMMIT_FORM; on your BUTTON.
Hope this helps
Hamid
Tags: Oracle Development
Similar Questions
-
How to insert data into the table by using the expression builder in the assign activity
How to insert data into the table by using the expression builder in affect business in BPEl, I use SOA Suite 11.1.1.5
Can someone help me pleaseHello
I don't think that oraext:query-database() can insert data into the table.
What are your needs?
Can not you plan to use the DB adapter with the insert operation?Kind regards
Neeraj Sehgal -
How to insert data into the table of plain text stored as a CLOB in another table
Hi people,
Maybe it's an easy question for someone who is more frequently used files and CLOB.
I have a table that stores text files in the CLOB column. Files text includes some basic data that I want to load in the other - a text line = a new insert for me. Is there a "trick" how to do it effectively?
Here is my model:
Table OS_IMPORT_DOCS, stores the complete files as CLOB
Sample data from OS_IMPORT_DOCSSQL> desc OS_IMPORT_DOCS Name Type Nullable Default Comments ------------- -------------- -------- ------- -------- OBJECT_ID NUMBER DATUM_ZMENY DATE sysdate FILE_PATH VARCHAR2(4000) Y FILE_NAME VARCHAR2(4000) Y FILE_SIZE NUMBER Y LAST_MODIFIED DATE Y DOCUMENT CLOB Y STATUS VARCHAR2(15) Y 'NEW'
Example of file CLOB - stored text data (select d.document from os_import_docs d where d.object_id = 1815042 ;)SQL> select * 2 from os_import_docs d 3 order by d.last_modified desc 4 ; OBJECT_ID DATUM_ZMENY FILE_PATH FILE_NAME FILE_SIZE LAST_MODIFIED DOCUMENT STATUS ---------- ----------- ------------------------------ --------------- ---------- ------------- ----------- --------------- 1815043 13.8.2012 1 d:\data\C120813.DAT C120813.DAT 16800 13.8.2012 16: <<CLOB>> NEW 1815042 13.8.2012 1 d:\data\C120812.DAT C120812.DAT 3600 12.8.2012 22: <<CLOB>> NEW 1815041 13.8.2012 1 d:\data\C120811.DAT C120811.DAT 1800 11.8.2012 13: <<CLOB>> NEW
Above the example text includes "columns" in plain text:061053120820120000AGT000002Osoby 0000000042301000000017210632 062322120820120000AGT000002Osoby 0000000012301000000017197566 063526120820120001AGT000002Osoby 0000000012301000000017197566 064234120820120001AGT000002Osoby 0000000103301000000162218777
timestamp - 1-14, SSMIHH24DDMMYYYY position format
flag - post 15-18
company code - position 19-27
etc...
How can I query data stored within the OS_IMPORT_DOCS. The DOCUMENT column, divide it into columns and insert into another table?
I have to read this method of 'online' file?
Thank you very much
TomasFor the first three columns:
SQL> create type TRecord is object ( 2 ts timestamp 3 , flag varchar2(4) 4 , company_code varchar2(9) 5 ); 6 / Type created SQL> SQL> create type TRecordTable is table of TRecord; 2 / Type created SQL> SQL> create or replace function parse_clob (p_doc in clob) 2 return TRecordTable pipelined 3 is 4 lf number; 5 eol varchar2(2) := chr(10); 6 eollen number := length(eol); 7 line varchar2(32767); 8 offs number := 1; 9 begin 10 loop 11 lf := dbms_lob.instr(p_doc, eol, offs); 12 if lf != 0 then 13 line := dbms_lob.substr(p_doc, lf - offs + 1 - eollen, offs); 14 offs := lf + eollen; 15 else 16 line := dbms_lob.substr(p_doc, dbms_lob.getlength(p_doc) - offs + 1, offs); 17 end if; 18 pipe row ( 19 TRecord( 20 to_timestamp(substr(line, 1, 14), 'HH24MISSDDMMYYYY') 21 , substr(line, 15, 4) 22 , substr(line, 19, 9) 23 ) 24 ); 25 exit when lf = 0; 26 end loop; 27 end; 28 / Function created SQL> SQL> select t.* 2 from os_import_docs d 3 , table(parse_clob(d.document)) t 4 where d.object_id = 1815042; TS FLAG COMPANY_CODE -------------------------------------- ---- ------------ 12/08/12 06:10:53,000000 0000 AGT000002 12/08/12 06:23:22,000000 0000 AGT000002 12/08/12 06:35:26,000000 0001 AGT000002 12/08/12 06:42:34,000000 0001 AGT000002
-
Insert data into the table from the flat Flie
I have a flat file save in a directory on my server. I would like to read the data from the flat file and insert into a table on the stage. The flat file data as below
01-02-03-04-05-06-07-08-09-10
Suppose that Location_stage is my table and c1 is the column name.
The data should be saved as follows
Select * from location_stage
C1
----
01
02
03
04
05
Any help will be appreciated.
Thank you
NSYou can define an external table to read data from the file and a simple view to convert the string enclosed in columns:
SQL> create directory ext_data as 'c:\'; Directory created. SQL> create table ext_locations ( 2 loc varchar2(4000) 3 ) 4 organization external 5 ( 6 type oracle_loader 7 default directory ext_data 8 access parameters ( 9 records delimited by newline 10 logfile ext_data:'ext_loc.log' 11 fields terminated by ',' (loc) 12 ) 13 location ('locations.txt') 14 ); Table created. SQL> select * from ext_locations; LOC ----------------------------------------------- 01-02-03-04-05-06-07-08-09-10 SQL> create view location_stage as 2 select regexp_substr(loc,'[^-]+',1,level) c1 3 from ext_locations 4 connect by level <= length(loc)-length(replace(loc,'-',''))+1; View created. SQL> select * from location_stage; C1 ---------------------------------------------------------------------------- 01 02 03 04 05 06 07 08 09 10 10 rows selected.
Your data is stored only in the file...
Max
-
inserting data into a table from another table
Hello
I have a to insert a data in the other table.
My requirement is I field Date_effect_date in the departments, I would copy the details field in dept_effect_date of employees.
I used the query
Insert in the dept_effect_date of certain employees (dept_effect_date) departments;
and the result is:
SQL error: ORA-01400: cannot insert NULL into ('HR'. "'"' EMPLOYEES'."" EMPLOYEE_ID')
01400 00000 - "impossible to insert a NULL value in (%s)."
MY DB: oracle 10g XE
Sainaba
You can do this by UPDATE not INSERT.
Sudheeryekkala wrote:
Hello
I have a to insert a data in the other table.
My requirement is I field Date_effect_date in the departments, I would copy the details field in dept_effect_date of employees.
I used the query
Insert in the dept_effect_date of certain employees (dept_effect_date) departments;
and the result is:
SQL error: ORA-01400: cannot insert NULL into ('HR'. "'"' EMPLOYEES'."" EMPLOYEE_ID')
01400 00000 - "impossible to insert a NULL value in (%s)."
MY DB: oracle 10g XE
Sainaba
INSERT the results of will by adding new lines to the table so you have the above error. In your case, you must update the value of the existing column
(or, if the volume is large, then fill the data -
join the table two in a new table CREATE TABLE EMP_NEW AS SELECT * FROM EMPLOYEES, DEPARTMENTS
. fall of
; Rename emp_new to
; * constraints/indexes if necessary be supported...
)
E employees update
Set e.dept_effect_date = (select d.dept_effect_date
departments d
where e.dept_id = d.dept_id);
Concerning
Biju
-
How to insert xml into a table in different format
Hello
My version of db: database Oracle 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production
I have a xml as below:
I want to insert the XML in the test of the table as below<?xml version="1.0"?> <ROWSET> <ROW> <a>CNET</a> <b>21416911</b> <c>12345678</c> <d>878787</d> </ROW> </ROWSET> creating a test table: CREATE TABLE test ( friendlyname VARCHAR2(150), value varchar2(200));
Please advice.SELECT * FROM test; friendlyname value a CNET b 21416911 c 12345678 d 878787
Here's the idea:
SQL> DECLARE 2 3 xmldoc xmltype := xmltype( 4 ' 5
6 ') ; 13 14 BEGIN 15 16 INSERT INTO test (friendlyname, value) 17 SELECT x.fname, x.value 18 FROM XMLTable( 19 '/ROWSET/ROW/*' 20 passing xmldoc 21 columns fname varchar2(150) path 'local-name(.)' 22 , value varchar2(200) path 'text()' 23 ) x ; 24 25 END; 26 / PL/SQL procedure successfully completed SQL> select * from test; FRIENDLYNAME VALUE ---------------- ------------ a CNET b 21416911 c 12345678 d 8787877 CNET 8 21416911 9
1212345678 10878787 11Can be optimized according to the size of input XML code and its location.
-
How to insert values into a table
Hello Experts,
I would like to know if its possible to fill data in one table by performing a loop.
I have the following table:
Draw)
NUMBER OF NUM,
START_DATE DATE NOT NULL,
END_DATE DATE NOT NULL,
CHAR DEFAULT ACTIVE (1 BYTE) 'Y')
Now my table must contain the foll:
NUM start_date end_date active
1 2010-01-23 21:00 30/01/2010 19:00 Y
2 2010-01-30 21:00 02/06/2010 19:00 Y
I have an initial date and the end_date is always (start_date + 7) and the beginning of the next by the previous end_date but time varies from 19:00 to 21:00.
This is what I have at the moment, but I'm stuck out of
but I'm kind of stuck a bit for the dateCREATE SEQUENCE num_seq MINVALUE 1 START WITH 1 INCREMENT BY 1 CACHE 10 CREATE OR REPLACE procedure draw_date IS begin INSERT INTO draws (num, start_date , end_date, active ) VALUES (num_seq.nextval, ?, ?+7 days, Y); COMMIT; end;
Thank youHello
You can try something like:
INSERT INTO draws (num, start_date, end_date, active) with last_date as (select trunc(max(end_date)) dt from draws) select num_seq.nextval, last_date.dt + 21/24, last_date.dt +7 +19/24, 'Y' from last_date; COMMIT;
Untested code because I don't have the create table and insert orders... and I'm feeling lazy today.
;) -
Problem in inserting records into a table (MS Access) where the name of the column against
I have a table with the name of column say first #Name and when I insert a value in the table it gives an error and it does not let me insert some values which he... Is it possible to enter the value in this column by fleeing this hash. I have a constraint that I can not change the name of the column...If it was Oracle you would put quotes around the name of the column. Not sure if happens the same for MS Access, because I do not play with the toy databases.
for example
Insert into tablename ("First#Name") values ('Fred');
-
Insert values into a table from another table without duplicates
Hello
I have a table with a field called ID; This field has duplicate values of ID.
Then I have an empty table B (with the same fields of the table A) and I want to insert the values of the ID (on the table) without duplicates.
Can you help me?
Thank you much in advance.Hello
If your table has duplicate values, then you cannot add a UNIQUE constraint. In this case, you will need to use a roundabout way or remove duplicates before imposing the constraint. Hope it answers your question.
see you soon
VT
-
How to insert rows in multiple tables in a sql
I want to know how to insert multiple lines in a single sql statement.
Let's insert records into the table emp and dept in a sql statement.
Thank youIt's here
SQL>l 1 insert all 2 into emp values(8888,'WADE','MANAGER',7839,'01-MAR-2008',5000,100,20) 3 into dept values(50,'MARKETING','NEW YORK') 4* select * from dual SQL> / 2 rows created.
SS
-
Insert a row into the table on a button click
Hi all
I have a table called 'temp' with 4 columns such as seq, name, event, id and I have a GP with 3 text such as name, event id fields
now my question is
If I enter values in the 3 text fields on this page and a button, click on (for example create), I wanted the values of dose to get inserted into the table 'temp' and
regarding, "seq" column I HAV created a sequence for it.
so 1. How to insert values into the table by entering the values in the page
2 wat shd b made to column seq... (shd b anyth made apex pages or wil automatically get values for each input line)
pls help me...
Thanks in advance
1, it is up to you change your account to something more user-friendly than '8f4692cc-040e-48ee-b102-590cdd4303fc'.
Then, it would also be a good idea to use proper English when you ask a question here... Not broken English as "now comes to my" and "wat shd b"... More people will be willing to help you if you at least put forward in order to ask a good question...
Which version of the database are you using? APEX version?
Change the code above to this process:
DECLARE
v_seq NUMBER;
BEGIN
Select SEQUENCE_NAME. NEXTVAL INTO v_seq
Double;
INSERT INTO temp (seq, name, event, id)VALUES (v_seq,: P1_name,: P1_event,: P1_id);
END;
This allows it to be used in older versions of Oracle that do not allow direct access to the sequence.nextval in an assignment statement.
Thank you
Tony Miller
Software LuvMuffin
-
Insert data into Oracle DB from MS Access Forms
Dear professionals,
How to insert data into the table that reside in the Oracle DB through MS Access forms?
We have already created ODBC link tables Oracle allows you to select data, and it works.
Unfortunately, we can select only the data, but insert, delete and update are not available via MS Access form, even if the user has all permissions on the oracle DB (grant select, insert, update, delete on oracle_table to access_user).
driver: Microsoft ODBC for Oracle
MS Access 2003
Oracle DB 10.2
THX in advance,
AdnanOne would need to know what means "not available". You get a specific error? As far as I know your statement is simply incorrect.
There are perhaps incompatibilties between DLLs Microsoft and Oracle, I would avoid the Microsoft ODBC for Oracle driver like the plague!---------
Sybrand Bakker
Senior Oracle DBA -
What trigger to use to insert data into the table db forms
Hello
My form is current having a block of database with the table reference. When you enter data into the form field and click Save. Automatically record is inserted in the database table.
I want to do this under manual insert. I changed the block of data to a data non-base. Where should I write the insert statement to insert data into the table.
Is - shutter release key of the form-level validation?
Please notify.
Thank you
Didi.You can guide me how to remove the message FRM-40401 no changes to save and instead, I wanted to put 1 transaction record successful... some like it like that.
Hi didi.
And this is my last post I'll sleep. ;)
Take form level trigger named preform
and write on it:SYSTEM.MESSAGE_LEVEL := 5;
I hope this works...
Hamid
Mark correct/good to help others to get the right answers. *
-
Hi all
I use forms [32 bit] Version 6.0.8.24.1 (Production)
Oracle Database 10g Release 10.2.0.1.0 - Production
I have settings such as the (optional) emp_code and the year (mandatory field - four digits).
Based on the setting that I have to get the detail of a table and these must be inserted at the other table with columns of additions (to hardcode the additional columns).
To achieve this, I intend to get a cursor by selecting the required fields in the table by the way the where clause of the cursor parameters.
by making a loop through the cursor I will insert the records in the other table.
Here, the thing is that the data is going to be huge (since the year is the parameter).
so my approach causes the performance issue.
I heard that there is a different method of insetions
can anyone suggest me the best way (performance wise) other than what I mentioned (if you are aware of)...
Thank you...user13329002 wrote:
Thanks for everyone.
I have to take the data from the table as e_name, e_code, of the table and insert it into another table with some other values such as
e_name, e_code, as well as I add 'n', 'o'.
its something likeinsert into e_emp(emp_name,emp_code,emp_add,emp_status,emp_type) select e_name,e_code,e_add,'O','N') from e_table where e_date = Parameter.
in other words, the values for Emp_status, emp_type I have no values in the e_table.so table and enter in e_table I have to hard code it.
CAL I hard code as I mentioned in my statement examplecan someone clear me of the foregoing.
Thank you...
Published by: user13329002 on February 15, 2011 20:11
Yes... You can hardcode the values for Emp_status, emp_type.
SQL> CREATE TABLE e_emp(emp_code NUMBER(10),emp_status VARCHAR2(1),emp_type VARCHAR2(1)); Table created. SQL> create table e_table as (select * from e_emp); Table created. SQL> INSERT INTO e_table(emp_code) VALUES('1111'); 1 row created. SQL> insert into e_table(emp_code) values('2222'); 1 row created. SQL> select * from e_table; EMP_CODE E E ---------- - - 1111 2222 SQL> insert into e_emp(emp_code,emp_status,emp_type) (select emp_code,'0','N' from e_table); 2 rows created. SQL> select * from e_emp; EMP_CODE E E ---------- - - 1111 0 N 2222 0 N SQL>
I hope this helps.
Kind regards
Claudy -
How to insert data into a BLOB column using sql
Hi all
How to insert data into the BLOB column directly using sql.
Thank youcreate table temp ( a blob, b clob); SQL> / Insert into temp values ('32aasdasdsdasdasd4e32','adsfbsdkjf') ; * ERROR at line 1: ORA-01465: invalid hex number Please help in this.
Prakash PInsert into temporary values (UTL_RAW. CAST_TO_RAW ('32aasdasdsdasdasd4e32'), 'adsfbsdkjf');
Maybe you are looking for
-
I did an upgrade FF v3.6.xx to v17.0.x and found that the order of items in the context menu 'Link' is not the same.v3.6 menu looks as follows: 1. "Open link in a new window", 2. "Open link in a new tab,"order of the items in menu v17.0 is 1 reverse.
-
Satellite Pro 4600: display problem
The laptop overheated (for the previous owner). When I bought it all was going well, but after 2 days (not more), the screen started showing artifacts many and varied, beginning with the Toshiba start screen. Can it be cured without changing the moth
-
Partitioning of the SSD &; FCPX
Passage to the SSD on a mounting system and will install FCPX on the SSD. What I read, it seems the best for * not * partition of the SSD and with these discs, it is no longer common practice to retain, as an example, a partition for applications, do
-
Hello world! I am trying to make an acquisition of digital input using the CFP 2020-di-330, but I do not understand how to make the physical connections. In the diagrams, I see two entries INa and INb, but I don't know who I have to use since I work
-
I was doing a recovery on my computer laptop dv6-3109ax of nephews running Win7 Home Premium with a 500 GB hard drive and 4 GB of ram when it turned off 23% of the way through the process. When I reboot it comes up with a black screen saying to Resta