Insert selected records
Hi,
I have a requirement as follows
I need to have a report (say in page1 on table1) with the checkboxes in order to select the required records.
When I click on next button, I should be able to display these selected records only to the next page(say page2) .
Page2 has submit button and when I click on submit these selected records should be inserted into a table(say table2).
I am able to create a report with checkboxes but not understanding how to collect these selected records to the next page and insert them into database table.
Kindly advice me how this can be achieved.
Thanks in Advance.
Sarvani.
Sarvani,
here is an example on how to select checked rows:
http://htmldb.oracle.com/pls/otn/f?p=31517:95
You should use an array to collect the picked records - item with concatenated primary
keys. After that, you may use the example here:
http://htmldb.oracle.com/pls/otn/f?p=31517:84
to insert those records into a table.
Denes Kubicek
http://deneskubicek.blogspot.com/
http://htmldb.oracle.com/pls/otn/f?p=31517:1
-------------------------------------------------------------------
Similar Messages
-
Need to insert selected records from PROD into TEST
I am trying to insert all records (for a specific region only) from production to test.
I'm a little confused about how the pl/sql would look for this.
Note that as I insert into the table in test, I also have a key field that is auto incremented by 1 each time.
The problem that I am having is I need to link two tables in PROD together to determine the region:
So in test, I want to do something like:
INSERT INTO ACCOUNT_PRICE
(select * from ACCOUNT_PRICE@PROD, MARKETER_ACCOUNT@PROD
where substr(MARKETER_ACCT_NO,1,1) = '3'
and MARKETER_ACCOUNT_NO = PRICE_ACCOUNT_NO);
However, i'm not sure if this is correct or if I should be using a BULK insert.
Note that I cannot just load the whole table as I need to restrict it to only one region of data.
Any help would be appreciated.
SeanDirect load (BULK) is irrelevant to what you are asking. I would strongly suggest that you read the docs about this feature before considering it for any purpose.
As to your question what you are asking is unclear and, for reasons known only to you, you did not include a version number.
So given that I get to invent your version number I have decided you have 10g and therefore you have DataPump so my recommendation is to use
DataPump to extract and export the records you wish to move.
http://www.morganslibrary.org/reference/dbms_datapump.html -
How i can Insert selected records in database table using check box.
Hi Friends,
I have non database block, which displayed multiple records, now I add a Check Box to this block and now I want to insert the records in a database table which I checked. So when I press a button, all the checked records are inserted in the table.
Please send me the code of this solution.
Thanks in advance.
ShahzadI have almost the exact scenario but instead of inserting into the DB, I want to find the Checked records and process them in PL/SQL script.
I currently have a cursor that looks for all the checked records. It's only getting the first record, so I figured I need to loop through the block looking for checked records.
Also can I save them to a temp or PL/SQL table to process later? -
Select records from one database and insert it into another database
Hi
I need to write a statement to select records from one database which is on machine 1 and insert these records on a table in another database which is on machine 2. Following is what I did:
1. I created the following script on machine 2
sqlplus remedy_intf/test@sptd @load_hrdata.sql
2. I created the following sql statements in file called load_hrdata.sql:
rem This script will perform the following steps
rem 1. Delete previous HR data/table to start w/ clean import tables
rem 2. Create database link to HR database, and
rem 3. Create User Data import table taking info from HR
rem 4. Drop HRP link before exiting
SET COPYCOMMIT 100
delete from remedy.remedy_feed;
commit;
COPY FROM nav/donnelley@hrp -
INSERT INTO remedy.remedy_feed -
(EMPLID, FIRST_NAME, MI, LAST_NAME, BUSINESS_TITLE, WORK_PHONE, -
RRD_INTRNT_EMAIL, LOCATION, RRD_OFFICE_MAIL, RRD_BUS_UNIT_DESCR) -
USING SELECT EMPLID, FIRST_NAME, MI, LAST_NAME, BUSINESS_TITLE, WORK_PHONE, -
RRD_INTRNT_EMAIL, LOCATION, RRD_OFFICE_MAIL, RRD_BUS_UNIT_DESCR -
FROM ps_rrd_intf_medium -
where empl_status IN ('A', 'L', 'P', 'S', 'X')
COMMIT;
EXIT;
However, whenever I run the statement I keep getting the following error:
SP2-0498: missing parenthetical column list or USING keyword
Do you have any suggestions on how I can fix this or what am I doing wrong?
Thanks
AliThis doesn't seem to relate to Adobe Reader. Please let us know the product you are using so we may redirect you or refer to the list of forums at http://forums.adobe.com/
-
Selecting Records from 125 million record table to insert into smaller table
Oracle 11g
I have a large table of 125 million records - t3_universe. This table never gets updated or altered once loaded, but holds data that we receive from a lead company.
I need to select records from this large table that fit certain demographic criteria and insert those into a smaller table - T3_Leads - that will be updated with regard to when the lead is mailed and for other relevant information.
My question is what is the best (fastest) approach to select records from this 125 million record table to insert into the smaller table. I have tried a variety of things - views, materialized views, direct insert into smaller table...I think I am probably missing other approaches.
My current attempt has been to create a View using the query that selects the records as shown below. Then use a second query that inserts into T3_Leads from this View V_Market. This is very slow. Can I just use an Insert Into T3_Leads with this query - it did not seem to work with the WITH clause? My Index on the large table is t3_universe_composite and includes zip_code, address_key, household_key.
CREATE VIEW V_Market as
WITH got_pairs AS
SELECT /*+ INDEX_FFS(t3_universe t3_universe_composite) */ l.zip_code, l.zip_plus_4, l.p1_givenname, l.surname, l.address, l.city, l.state, l.household_key, l.hh_type as l_hh_type, l.address_key, l.narrowband_income, l.p1_ms, l.p1_gender, l.p1_exact_age, l.p1_personkey, e.hh_type as filler_data, 1.p1_seq_no, l.p2_seq_no
, ROW_NUMBER () OVER ( PARTITION BY l.address_key
ORDER BY l.hh_verification_date DESC
) AS r_num
FROM t3_universe e
JOIN t3_universe l ON
l.address_key = e.address_key
AND l.zip_code = e.zip_code
AND l.p1_gender != e.p1_gender
AND l.household_key != e.household_key
AND l.hh_verification_date >= e.hh_verification_date
SELECT *
FROM got_pairs
where l_hh_type !=1 and l_hh_type !=2 and filler_data != 1 and filler_data != 2 and zip_code in (select * from M_mansfield_02048) and p1_exact_age BETWEEN 25 and 70 and narrowband_income >= '8' and r_num = 1
Then
INSERT INTO T3_leads(zip, zip4, firstname, lastname, address, city, state, household_key, hh_type, address_key, income, relationship_status, gender, age, person_key, filler_data, p1_seq_no, p2_seq_no)
select zip_code, zip_plus_4, p1_givenname, surname, address, city, state, household_key, l_hh_type, address_key, narrowband_income, p1_ms, p1_gender, p1_exact_age, p1_personkey, filler_data, p1_seq_no, p2_seq_no
from V_Market;I had no trouble creating the view exactly as you posted it. However, be careful here:
and zip_code in (select * from M_mansfield_02048)
You should name the column explicitly rather than select *. (do you really have separate tables for different zip codes?)
About the performance, it's hard to tell because you haven't posted anything we can use, like explain plans or traces but simply encapsulating your query into a view is not likely to make it any faster.
Depending on the size of the subset of rows you're selecting, the /*+ INDEX hint may be doing your more harm than good. -
Error inserting XML records 4000 bytes through Pro*C
Hi,
I am seeing the following error while trying to insert XML records > 4000 bytes (Records < 4000 bytes get inserted without any issues). Any help in resolving the issue would be highly appreciated.
ORA return text: ORA-01461: can bind a LONG value only for insert into a LONG column.
I am also able to insert records > 4000 bytes using the following query, But, I want to insert the records through a C application (using Pro*C) that is not running on the database server.
INSERT INTO MY_XML_TABLE
VALUES (XMLType(bfilename('XML_DIR', 'MY_FILE.XML'),
nls_charset_id('AL32UTF8')));
Oracle Version
===============
SQL> select * from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for Solaris: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
Pro*C/C++ version:
====================
Pro*C/C++ RELEASE 11.2.0.0.0 - PRODUCTION
Schema registration:
====================
begin
DBMS_XMLSCHEMA.registerSchema (
SCHEMAURL => 'MY_XML_SCHEMA.xsd',
SCHEMADOC => bfilename ('ENG_REPORTS', 'MY_XML_SCHEMA.xsd'),
GENTYPES => FALSE,
OPTIONS => DBMS_XMLSCHEMA.REGISTER_BINARYXML,
CSID =>nls_charset_id ('AL32UTF8'));
end;
Table creation
===============
CREATE TABLE MY_XML_TABLE (
MY_XML_RECORD XmlType )
XMLTYPE MY_XML_RECORD STORE AS BINARY XML
XMLSCHEMA "MY_XML_SCHEMA.xsd" ELEMENT "MYXMLTAG" ;
Record Insertion (Pro*C generated code):
=========================================
/* EXEC SQL FOR :l_sizeof_array_togo
insert INTO MY_XML_TABLE
(MY_XML_RECORD )
VALUES( XMLTYPE(:l_XML_ptr INDICATOR :l_XML_indicators )); */
struct sqlexd sqlstm;
sqlstm.sqlvsn = 12;
sqlstm.arrsiz = 1;
sqlstm.sqladtp = &sqladt;
sqlstm.sqltdsp = &sqltds;
sqlstm.stmt = "insert into MY_XML_TABLE (MY_XML_RECORD) values (XMLTYPE(:s1\
:s2 ))";
sqlstm.iters = (unsigned int )l_sizeof_array_togo;
sqlstm.offset = (unsigned int )20;
sqlstm.cud = sqlcud0;
sqlstm.sqlest = (unsigned char *)&sqlca;
sqlstm.sqlety = (unsigned short)4352;
sqlstm.occurs = (unsigned int )0;
sqlstm.sqhstv[0] = (unsigned char *)&l_XML_ptr->xml_record;
sqlstm.sqhstl[0] = (unsigned long )8002;
sqlstm.sqhsts[0] = ( int )sizeof(struct xml_rec_definition);
sqlstm.sqindv[0] = ( short *)&l_XML_indicators->XML_record_ind;
sqlstm.sqinds[0] = ( int )sizeof(struct XML_indicator);
sqlstm.sqharm[0] = (unsigned long )0;
sqlstm.sqadto[0] = (unsigned short )0;
sqlstm.sqtdso[0] = (unsigned short )0;
sqlstm.sqphsv = sqlstm.sqhstv;
sqlstm.sqphsl = sqlstm.sqhstl;
sqlstm.sqphss = sqlstm.sqhsts;
sqlstm.sqpind = sqlstm.sqindv;
sqlstm.sqpins = sqlstm.sqinds;
sqlstm.sqparm = sqlstm.sqharm;
sqlstm.sqparc = sqlstm.sqharc;
sqlstm.sqpadto = sqlstm.sqadto;
sqlstm.sqptdso = sqlstm.sqtdso;
sqlcxt((void **)0, &sqlctx, &sqlstm, &sqlfpn);
}After selecting data from xmltab table I just received first line of xmldata file. i.e
<?xml version="1.0" encoding="WINDOWS-12 52"?> <BAROutboundXM L xmlns="http://BARO
That must be a display issue.
What client tool are you using, and what version?
If SQL*Plus, you won't see the whole content unless you set some options :
{code}
SET LONG <value>
SET LONGCHUNKSIZE <value>
{code}
Could you try the following?
{code}
SET LONG 10000
SELECT t.object_value.getclobval() FROM xmltab t;
-- to force pretty-printing :
SELECT extract(t.object_value, '/*').getclobval() FROM xmltab t;
{code}
Edited by: odie_63 on 16 févr. 2011 08:58 -
Error in inserting a record in to table
hi..
i created a trigger....when i am trying to insert new record in to table i am getting the fallowing error...plz kindly help me out from this...
SQL> create or replace trigger secure_emp
2 before insert on employees begin
3 if(to_char('sysdate','DY') in ('SAT','SUN')) or
4 (to_char('sysdate','HH24:MI') not between '8:00' and '18:00') then
5 raise_application_error(-20500,'error');
6 end if;
7 end;
8 /
Trigger created.
SQL> insert into employees(employee_id,last_name,first_name,email,hire_date,job_id,salary,department
_id)
2 values (300,'smith','jack','SJACK',sysdate,'IT_PROG',4500,60);
insert into employees(employee_id,last_name,first_name,email,hire_date,job_id,salary,department_id)
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: character to number conversion error
ORA-06512: at "SCOTT.SECURE_EMP", line 2
ORA-04088: error during execution of trigger 'SCOTT.SECURE_EMP'Yeah. Whenever Oracle sees TO_CHAR('string_literal1', 'string_literal2), it implicitly converts it to TO_CHAR(TO_NUMBER('string_literal1'), 'string_literal2). That's why an error in trigger occurs.
SQL> explain plan for
2 select null
3 from dual
4 where dummy = to_char('A', 'DY');
Explained
SQL> @utlxpls
Cannot SET MARKUP
PLAN_TABLE_OUTPUT
Plan hash value: 397561404
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 2 | 2 (0)| 00:00:01 |
|* 1 | TABLE ACCESS FULL| DUAL | 1 | 2 | 2 (0)| 00:00:01 |
Predicate Information (identified by operation id):
1 - filter("DUMMY"=TO_CHAR(TO_NUMBER('A'),'DY'))
13 rows selected -
Problem with inserting new records in Oracle Forms
Hi Friends,
I am a new user to Oracle Forms and I need a help from you people. The problem is as follows:
I have a data block in which I can display a number of records. In this data block the user will be able to edit the fields if no child records are found in another table. I have used when-new-record-instance to attain this scenario. All are text items. One item licensee_id which is made invisible by setting the property in property palette and required=no ( as this is the primary key of the table). Also the audit columns are made invisible.
The code for it is as follows:
DECLARE
v_alert_button NUMBER;
v_cnt NUMBER;
BEGIN
SELECT COUNT (*)
INTO v_cnt
FROM id_rev_contracts
WHERE licensee_id = :ID_REV_LICENSEES.licensee_id;
IF v_cnt > 0 THEN
set_item_property('ID_REV_LICENSEES.LICENSEE_NAME', UPDATE_ALLOWED, PROPERTY_FALSE);
ELSE
set_item_property('ID_REV_LICENSEES.LICENSEE_NAME', UPDATE_ALLOWED, PROPERTY_TRUE);
-- set_item_property('ID_REV_LICENSEES.LICENSEE_NAME', INSERT_ALLOWED, PROPERTY_TRUE);
END IF;
END;
Now in this data block I should also be able to insert new records and for the same I have used PRE-INSERT trigger and the code for it is as follows:
DECLARE
v_alert_button NUMBER;
CURSOR v_licensee_id IS SELECT id_rev_licensees_s.NEXTVAL FROM dual;
BEGIN
OPEN v_licensee_id;
FETCH v_licensee_id INTO :id_rev_licensees.licensee_id;
CLOSE v_licensee_id;
IF :id_rev_licensees.licensee_id IS NULL THEN
Message('Error Generating Next v_licensee_id');
RAISE Form_Trigger_Failure;
END IF;
:ID_REV_LICENSEES.created_by := :GLOBAL.g_login_name;
:ID_REV_LICENSEES.last_updated_by := :GLOBAL.g_login_name;
:ID_REV_LICENSEES.create_date := SYSDATE;
:ID_REV_LICENSEES.last_update_date := SYSDATE;
EXCEPTION
WHEN form_trigger_failure
THEN
RAISE form_trigger_failure;
WHEN OTHERS
THEN
v_alert_button :=
msgbox ('ERROR in Pre-Insert - ' || SQLERRM, 'STOP', 'Contact IST');
RAISE form_trigger_failure;
END;
Every thing is compiling fine but at the run time when I am trying to insert a new record I am receiving the following error:
FRM-40508:ORACLE error:unable to insert record
I also think the pre-insert record is not firing at the time of inserting a new record and saving it. So I request you to please delve into this problem and suggest me how to overcome this problem. Code snippets would do more help for me. If you need any other things from me please let me know. I will see if I could be of any help in that concern because I may not be able to send the entire form as it is.
Thanks and regards,
Vamsi K Gummadi.first of all
pre-insert fires after the implicit/explicit commit/commit_form is issued and before the real insert is submitted to the db.
i would suggest to remove the error handling part for the moment
because i believe you might be getting "ora-xxxx cannot insert null"
and also make visible the primary column to check if the pre-insert is executed.
it would be better to make visible for a while the not null columns of the table/block
i suppose that the block is insert allowed and you are using table as the source of the block and not any procedures or something... -
Insert missing records dynamically in SQL Server 2008 R2
Hi, I am working on a requirement where I will have to work on some % calculations for 2 different states where we do business. The task that I am trying to accomplish is technically we need to have any Product sales in both the states if not for instance
in the following example ProductC does not have sales in OR so I need to insert a record for ProductC - OR with 0. This is an intermediary resultset of all the calculations that I am working with.
Example Dataset:
CREATE TABLE [dbo].[Product](
[Product] [varchar](18) NOT NULL,
[State] [varchar](5) NOT NULL,
[Area1] [int] NOT NULL,
[Area2] [int] NOT NULL,
[Area3] [int] NOT NULL,
[Area4] [int] NOT NULL,
[Area5] [int] NOT NULL,
[Area6] [int] NOT NULL,
[Area7] [int] NOT NULL,
[Area8] [int] NOT NULL,
[Area9] [int] NOT NULL,
[Area10] [int] NOT NULL,
[Total] [int] NULL
INSERT INTO [Product] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductA','OR',0,0,2,0,2,0,0,0,0,0,4)
INSERT INTO [Product] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductA','WA',0,0,1,0,0,0,0,0,0,0,1)
INSERT INTO [Product] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductA','Total',0,0,3,0,2,0,0,0,0,0,5)
INSERT INTO [Product] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductB','OR',0,0,5,0,0,0,0,0,0,0,5)
INSERT INTO [Product] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductB','WA',0,0,2,0,0,1,0,0,0,0,3)
INSERT INTO [Product] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductB','Total',0,0,7,0,0,1,0,0,0,0,8)
INSERT INTO [Product] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductC','WA',0,0,0,0,0,0,0,0,0,1,1)
INSERT INTO [Product] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductC','Total',0,0,0,0,0,0,0,0,0,1,1)
INSERT INTO [Product] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductD','OR',5,2,451,154,43,1,0,0,0,0,656)
INSERT INTO [Product] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductD','WA',0,20,102,182,58,36,0,1,0,0,399)
INSERT INTO [Product] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductD','Total',5,22,553,336,101,37,0,1,0,0,1055)
How to accomplish this in SQL Server 2008 R2.
Insert missing record:
INSERT INTO [Product] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductC','OR',0,0,0,0,0,0,0,0,0,0,0)
Thanks in advance......
IoneCREATE TABLE [dbo].[Products](
[Product] [varchar](18) NOT NULL,
[State] [varchar](5) NOT NULL,
[Area1] [int] NOT NULL,
[Area2] [int] NOT NULL,
[Area3] [int] NOT NULL,
[Area4] [int] NOT NULL,
[Area5] [int] NOT NULL,
[Area6] [int] NOT NULL,
[Area7] [int] NOT NULL,
[Area8] [int] NOT NULL,
[Area9] [int] NOT NULL,
[Area10] [int] NOT NULL,
[Total] [int] NULL
INSERT INTO [Products] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductA','OR',0,0,2,0,2,0,0,0,0,0,4)
INSERT INTO [Products] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductA','WA',0,0,1,0,0,0,0,0,0,0,1)
INSERT INTO [Products] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductA','Total',0,0,3,0,2,0,0,0,0,0,5)
INSERT INTO [Products] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductB','OR',0,0,5,0,0,0,0,0,0,0,5)
INSERT INTO [Products] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductB','WA',0,0,2,0,0,1,0,0,0,0,3)
INSERT INTO [Products] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductB','Total',0,0,7,0,0,1,0,0,0,0,8)
INSERT INTO [Products] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductC','WA',0,0,0,0,0,0,0,0,0,1,1)
INSERT INTO [Products] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductC','Total',0,0,0,0,0,0,0,0,0,1,1)
INSERT INTO [Products] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductD','OR',5,2,451,154,43,1,0,0,0,0,656)
INSERT INTO [Products] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductD','WA',0,20,102,182,58,36,0,1,0,0,399)
INSERT INTO [Products] ([Product],[State],[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])VALUES('ProductD','Total',5,22,553,336,101,37,0,1,0,0,1055)
;WIth mycte as (
Select Product,State From (Select distinct Product from Products) p, (
Select distinct State from Products) s
Insert into [Products](Product,State,[Area1],[Area2],[Area3],[Area4],[Area5],[Area6],[Area7],[Area8],[Area9],[Area10],[Total])
Select m.Product,m.State
,0,0,0,0,0,0,0,0,0,0,0
from mycte m Left Join Products p on m.[Product]=p.Product and m.State=p.State
WHERE p.Product is null and p.State is null
select * from Products
Order by Product
,Case when State='Total' Then 2 else 1 End
Drop table Products -
Data Loader inserting duplicate records
Hi,
There is an import that we need to run everyday in order to load data from another system into CRM On Demand . I have set up a data loader script which is scheduled to run every morning. The script should perform insert operation.
Every morning a file with new insert data is available in the same location(generated by someone else) & same name. The data loader script must insert all records in it.
One morning , there was a problem in the other job and a new file was not produced. When the data loader script ran , it found the old file and re-inserted the records (there were 3 in file). I had specified the -duplicatecheckoption parameter as the external id, since the records come from another system, but I came to know that the option works in the case of update operations only.
How can a situation like this handled in future? The external id should be checked for duplicates before the insert operation is performed. If we cant check on the data loader side, is it possible to somehow specify the field as 'unique' in the UI so that there is an error if a duplicate record is inserted? Please suggest.
Regards,Hi
You can use something like this:
cursor crs is select distinct deptno,dname,loc from dept.
Now you can insert all the records present in this cursor.
Assumption: You do not have duplicate entry in the dept table initially.
Cheers
Sudhir -
Inserting multiple records in to database table using webdynpro abap
Hi all,
I have created a username inputfield,a button and a table
with one coloumn.
If i enter names in the input field then the values should be
displayed in that table.
Even i have got the answer i am not able to insert
the values in to database(ztable) table.
i.e. only one value(1st) was inserted the second value was
not inserted ....
so kindly send me the coding to insert multiple records
into the database table......
by,
ranjithhi Ranjith,
If you want to insert multiple records from the webdynpro view table to database table then try the following code.
DATA lo_nd_tablenode TYPE REF TO if_wd_context_node.
DATA lo_el_tablenode TYPE REF TO if_wd_context_element.
DATA ls_tablenode TYPE wd_this->element_tablenode.
DATA it_tablenode LIKE STANDARD TABLE OF ls_tablenode.
navigate from <CONTEXT> to <tablenode> via lead selection
lo_nd_tablenode = wd_context->get_child_node( name = wd_this->wdctx_tablenode ).
get element via lead selection
lo_el_tablenode = lo_nd_tablenode->get_element( ).
get all declared attributes
lo_nd_tablenode->get_static_attributes_table(
IMPORTING
table = it_tablenode ).
MODIFY databasetablename FROM TABLE it_tablenode.
here it_tablenode is the internal table which holds the value from webdynpro view..
Regards,
Shamila. -
How to insert multiple records?
I have dynamically checkboxes, which get the data from database. I have used a FOR loop to store each value of the checkbox to session variables, i.e.
session.setAttribute("Slangs"+a,request.getParameter("langsID"+a)); (p/s: a is a counter, I also set a hidden variable to store the number of record in DB)
Now, I wanna insert these records to the table called CusLangs which has CusID(PK) and Langs(PK). I wanna construct a insert.jsp, so that those checkboxes that I selected can be written into table CusLangs.
Anyone know how to do that?
Thanks.
From
jeffYou have a checkboxes with the same name in your html/jsp.When you post to a servlet/jsp, use request.getParameterValues("checkboxname ) to get String [], ie.
<html>
<input type="checkbox" name="sampleCheck" value="1">
<input type="checkbox" name="sampleCheck" value="2">
</html>
Servlet/ JSP
String check[] = request.getParameterValues("sampleCheck");
query = "Insert into CusLangs (CusID) values (?') ";
stmt = connection.prepareStatement(query);
for(int i=0, i < check.length, i++) {
stmt.setString(1, check[0]);
int x = stmt.executeUpdate();
Hope this will help. -
How to insert 20 records only in one table
hi to all,
i want insert 20 records only in a table,but suppose i want to enter 21th record it will not inserted .
suppose delete one record then insert, it will insert.
but always count(*) is not greater than 20.
is there any solution for that,
pls help meYes there is a solution for that using a materialied view:
SQL> select * from v$version;
BANNER
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
SQL> drop table t purge;
Table dropped.
SQL> drop materialized view t_mv;
Materialized view dropped.
SQL> create table t (
2 x integer,
3 y varchar2(30)
4 );
Table created.
SQL> CREATE MATERIALIZED VIEW LOG on t
2 WITH ROWID (x, y)
3 including new values;
Materialized view log created.
SQL> CREATE MATERIALIZED VIEW t_mv
2 REFRESH FAST ON COMMIT AS
3 SELECT count(*) cnt
4 FROM t;
Materialized view created.
SQL> alter table t_mv ADD CONSTRAINT chk check(cnt<=20);
Table altered.
SQL> insert into t select object_id, object_name from all_objects where rownum <
21;
20 rows created.
SQL> commit;
Commit complete.
SQL> insert into t values(21,'KO');
1 row created.
SQL> commit;
commit
ERROR at line 1:
ORA-12008: error in materialized view refresh path
ORA-02290: check constraint (TEST.CHK) violated
SQL>
SQL> select count(*) from t;
COUNT(*)
20
SQL>Not sure that trigger based solution works due to multi versioning read consistency. -
How to insert multiple records in a single query
Dear all,
Can you please tell
how to insert multiple records in a single query ??INSERT INTO table_name (column_1, column_2) VALUES ('value_A', 'value_B')OR
INSERT INTO table_name
(column_1, column_2)
SELECT 'value_A', 'value_B' FROM DUAL
UNION ALL
SELECT 'value_C', 'value_D' FROM DUAL
;Edited by: Benton on Nov 9, 2010 1:59 PM -
Insert Multiple records in single form
Hi all,
I have already come across inserting multiple rows into a table using ADF BC. The solution to this is in the following thread
Re: How to create multiple new rows in ADF Table?
However,
The above solution is useful when we want to enter new values along with all the table entries getting displayed.
What can I do If I dont want all the table values but just an 'AddEntries' page where I can only add new rows without having the entries in table getting displayed.
Like,
Say, a form has 5 rows
Each row has empId, eMailSlNo ,eMail attributes
EmpId is same for all 5 records but emailId is different.
EmpId and eMailSlNo make the PK.
empId generated using sequence.
Now on submitting the form, I want all five records to be inserted.
(can i use ADF form instead of ADF table for the ViewObject in this case. I tried ADF form but i could only insert 1 record at a time).
I'm using 10.1.3.4
Please help.
Thanks in advance,
Shri
Edited by: newtoOTN on Dec 29, 2009 6:02 PMHi Shri,
ADF Form is meant for single insert/update. For multiple insert/update/delete using collection UI like table is preferred. I guess that either your db table or the UI table design has flaw (In my opinion but i don't know your usecase fully, so my guess might b wrong).
I would suggest,
- make EmpId as PK
- have another table to store EmpId(foreign key),emailSiNo, email
- Have master-detail relationship between both the db tables in ADF BC.
- Create master-detail table UI and on selection of master, display detail and if no records found add records and commit.
check these examples:
http://www.oracle.com/technology/products/jdev/tips/mills/MasterDetailSync/Master_Detail_Synchronization_in_ADF_Faces.html
http://andrejusb.blogspot.com/2007/06/create-edit-and-delete-operations-in.html
Hope this makes sense.
~K
Maybe you are looking for
-
Remove ":" from select option label(description)
Hello All I have a requirement to remove the select option description (which SAP displays by default from the field label maintained in the data element), I thought the best way to achieve that requirement is by passing "space" to the parameter 'I_
-
How to calculate some value that referring to another table
Hi... Need help asap The questions are : Q1 : In Microsoft Excell, we can take value from one cell and use it to another cell. How about in BO, if we want to take value (ex. 93.75) from the other table and use or refer the value that we want to to an
-
To see the share the scrap in PPM
Dear gurus I wish to see the PPM for the characteristics after UD. I check in characteristics overview but I can see the share of scrap in % (i.e.-66.67%), kindly suggest the way to see in PPM Best Regards MK
-
Default preferences for every active directory users
Hi, I have been searching for a solution to this for a long time and I hope somebody out there can help because I am sure that it is a common request on corporate networks. I am trying to configure a default desktop that provides exactly the same set
-
Hi everyone, I am slowly getting to grips with Premiere Elements12. When uploading to Facebook how can I remove the "via Photoshop & Adobe Premiere Elements Uploader" ? I see there was an earlier posting (http://forums.adobe.com/message/3320214#33202