Insert the value from the date of the operation, max
HelloWe use oracle 10g R2 on windows.
I want to insert values from one table to the other. Suppose I have a table emp (empcode, salary, dt_update) and have another table emp_live (empcode, salary).
data into the emp table are as
EMPCODE SALARY DT_UPDATE
281G 10611230.319 10/9/2010 6:38:30 PM
281G 37819399.457 10/8/2010 6:38:30 PM
291G 16500012.429 10/10/2010 6:38:30 PM
291G 108145595.738 10/9/2010 6:38:30 PM
292G 79449005.406 10/11/2010 6:38:30 PM
292G 198819948.865 10/10/2010 6:38:30 PM
293E 4532332.618 10/12/2010 6:38:30 PM
293E 142572824.216 10/11/2010 6:38:30 PM
294D 116505728.748 10/13/2010 6:38:30 PM
294D 90087585.925 10/12/2010 6:38:30 PM
My requirement is to insert only those records where the maximum date of DT_UPDATE.In the above senario only records below need to obtain insert
EMPCODE SALARY DT_UPDATE
281G 10611230.319 10/9/2010 6:38:30 PM
291G 16500012.429 10/10/2010 6:38:30 PM
292G 79449005.406 10/11/2010 6:38:30 PM
293E 4532332.618 10/12/2010 6:38:30 PM
294D 116505728.748 10/13/2010 6:38:30 PM
I am trying to insert it asinsert into emp_live select empcode,salary from emp where dt_update=(select max(dt_update) from emp)
But above not giving not correct results beacase when I select the records asselect empcode,max(dt_update) from emp group by empcode
Above shows 1665 records, but when I am inserting only insert 16 records.Help, please.
Something like this:
create table test (empcode varchar2 (4), salary number, date of dt_update);
Insert test values (' ' 281 G ", 10611230.319, to_date (October 9, 2010 06:38:30 ',' mm/dd/yyyy HH24:MI:SS));))
Insert test values (' ' 281 G ", 37819399.457, to_date (October 8, 2010 06:38:30 ',' mm/dd/yyyy HH24:MI:SS));))
Insert test values (' ' 291 G ", 16500012.429, to_date (October 10, 2010 06:38:30 ',' mm/dd/yyyy HH24:MI:SS));))
Insert test values (' ' 291 G ", 108145595.738, to_date (October 9, 2010 06:38:30 ',' mm/dd/yyyy HH24:MI:SS));))
Insert test values (' ' 292 G ", 79449005.406, to_date (October 11, 2010 06:38:30 ',' mm/dd/yyyy HH24:MI:SS));))
Insert test values (' ' 292 G ", 198819948.865, to_date (October 10, 2010 06:38:30 ',' mm/dd/yyyy HH24:MI:SS));))
insert into test values ('293E', 4532332.618, to_date (October 12, 2010 06:38:30 ',' mm/dd/yyyy HH24:MI:SS));))
insert into test values ('293E', 142572824.216, to_date (October 11, 2010 06:38:30 ',' mm/dd/yyyy HH24:MI:SS));))
Insert test values ('294, 116505728.748, to_date (October 13, 2010 06:38:30 ',' mm/dd/yyyy HH24:MI:SS));))
Insert test values ('294, 90087585.925, to_date (October 12, 2010 06:38:30 ',' mm/dd/yyyy HH24:MI:SS));))
SQL> column salary for 99999999999.9999;
SQL> select * from test;
EMPC SALARY DT_UPDATE
---- ----------------- ---------
281G 10611230.3190 09-OCT-10
281G 37819399.4570 08-OCT-10
291G 16500012.4290 10-OCT-10
291G 108145595.7380 09-OCT-10
292G 79449005.4060 11-OCT-10
292G 198819948.8650 10-OCT-10
293E 4532332.6180 12-OCT-10
293E 142572824.2160 11-OCT-10
294D 116505728.7480 13-OCT-10
294D 90087585.9250 12-OCT-10
10 rows selected.
SQL> ed
Wrote file afiedt.buf
1 select min(empcode),max(salary),max(dt_update)
2 from test
3 group by empcode
4* order by 1
SQL> /
MIN( MAX(SALARY) MAX(DT_UP
---- ----------- ---------
281G 37819399.5 09-OCT-10
291G 108145596 10-OCT-10
292G 198819949 11-OCT-10
293E 142572824 12-OCT-10
294D 116505729 13-OCT-10
SQL> insert into test
2 (
3 select min(empcode) empcode,max(salary) salary,max(dt_update) dt_update
4 from test
5 group by empcode
6 )
7 /
5 rows created.
SQL> select * from test;
EMPC SALARY DT_UPDATE
---- ----------------- ---------
281G 10611230.3190 09-OCT-10
281G 37819399.4570 08-OCT-10
291G 16500012.4290 10-OCT-10
291G 108145595.7380 09-OCT-10
292G 79449005.4060 11-OCT-10
292G 198819948.8650 10-OCT-10
293E 4532332.6180 12-OCT-10
293E 142572824.2160 11-OCT-10
294D 116505728.7480 13-OCT-10
294D 90087585.9250 12-OCT-10
281G 37819399.4570 09-OCT-10
EMPC SALARY DT_UPDATE
---- ----------------- ---------
293E 142572824.2160 12-OCT-10
294D 116505728.7480 13-OCT-10
291G 108145595.7380 10-OCT-10
292G 198819948.8650 11-OCT-10
15 rows selected.
SQL>
Concerning
Girish Sharma
Tags: Database
Similar Questions
-
How to insert the value from the FORM to another database table?
Hi all
I have the following problem.
I have a form that has a tabular layout for the MATURED_FD_DTLtable. (all about 20 line items)
CREATE TABLE MATURED_FD_DTL
(
ACCT_FD_NO VARCHAR2 (17 BYTE) NOT NULL,
CUST_CODE NUMBER (9),
FD_AMT NUMBER (15),
FD_INT_BAL NUMBER (15),
TDS NUMBER (15),
CHQ_NO NUMBER (10),
CREATED_DATE DATE,
CREATED_BY VARCHAR2 (15 BYTE),
PREV_YR_TDS NUMBER (15),
ADD_FD_AMT NUMBER (15),
DESCRIPTION VARCHAR2 (100 BYTE),
P_SAP_CODE NUMBER (10),
P_TYPE VARCHAR2 (1 BYTE)
)
By clicking on 'SAVE' button, all values will be automatically is stored in the MATURED_FD_DTLdatabase table.
But I want to insert these values in another table called TEMP.
I want to insert values of form only, no table select.
How can I do this?
Help me.
Is Oracle Designer 6i.
Answer:
BEGIN
Commit_form;
PREMIER_ENREGISTREMENT;
LOOP
insert into TEMP_MATURED_FD_DTL
SELECT * FROM MATURED_FD_DTL WHERE ACCT_FD_NO =: acct_fd_NO;
WHEN THE OUTPUT: SYSTEM. LAST_RECORD = "TRUE";
NEXT_RECORD;
END LOOP;
PREMIER_ENREGISTREMENT;
COMMIT;
MESSAGE ("RECORD UPDATED AS PAID '");
MESSAGE (' ', no_acknowledge);
END;
-
Select values from the db1 table and insert into the DB2 table
Hello
I have three databases oracle running in three different machines. their ip address is different. among the DB can access databases. (means am able to select values and insert values into tables individually.)
I need to extract data from the DB1 table (ip say DB1 is 10.10.10.10 and the user is DB1user and the table is DB1user_table) and insert the values into DB2 table (say ip DB2 is 11.11.11.11 and the user is DB2user and table DB2user_table) of DB3 that is to have access to the two IPs DB.
How do I do this
Edited by: Aemunathan on February 10, 2010 23:12Depending on the amount of data must be moved between DB1 and DB2, and the frequency at which this should happen, you might consider the SQL * COPY more control. I think it's very useful for one-off tasks little, so I can live within its limits of the data type. More http://download.oracle.com/docs/cd/E11882_01/server.112/e10823/apb.htm#i641251.
Change some parameter of sqlplus session are almost mandatory in order to get decent transfer rates. Tuning ARRAYSIZE and COPYCOMMIT can make a huge difference in flow. LONG change may be necessary, too, depending on your data. The documentation offers these notes on use:
To activate the copy of data between Oracle and databases non-Oracle, NUMBER of columns is replaced by DECIMAL columns in the destination table. Therefore, if you are copying between Oracle databases, a NUMBER column with no precision will become a DECIMAL column (38). When copying between Oracle databases, you must use SQL commands (CREATE TABLE AS and INSERTION), or you must make sure that your columns have a specified precision.
SQL * the VALUE LONGER variable limits the length of the LONG column you are copying. If all LONG columns contain data exceeds the value of LONG, COPY truncates the data.
SQL * Plus performs a validation at the end of each successful COPY. If you set the SQL * variable more COPYCOMMIT DEFINED to a value positive n, SQL * Plus performs a validation after copying all lots n of records. The SQL * Plus ARRAYSIZE variable SET determines the size of a batch.
Some operating environments require that the service names be placed between double quotes.
From a SQL * Plus term on DB3, can resemble the command to move all content from my_table in DB1 to the same table in DB2
COPY from user1/pass1@DB1 to user2/pass2@DB2 - INSERT INTO my_table - USING select * from my_table
Note the SQL code * more line-continuation character ' - '. It is used to escape the newline character in a SQL * Plus command if you do not have to type all on one line. I use it all the time with this command, but I can't locate the documentation on that right now. Maybe someone else can put their finger on it.
There are other ways to accomplish what the command copy and it is not without its quirks and limitations, but I find that there is usefulness in an Oracle Toolbox.
-
Can someone help me create a procedure with the DML statements that insert values from 1 to 100 in a table "abc" and the procedure must connect the numbers into words in another table "xyz" without doing a commit explicitly. "."
Currently on trial...
SQL > create table abc (num number);
Table created.
SQL > create table xyz (num varchar2 (100));
Table created.
SQL > ed
A written file afiedt.buf1. insert all
2 values of 1 = 1 then in abc (num) (l)
3 when the values of 1 = 1 then in xyz (num) (to_char (to_date(l,'j'), 'jsp'))
4 * Select the level from dual connect by level<=>=>
SQL > /.200 rows created.
And the result...
SQL > select * from abc;
NUM
----------
1
2
3
4
5
6
7
8
9
10
11
12
..
..
..
98
99
100100 selected lines.
SQL > select * from xyz;
NUM
----------------------------------------------------------------------------------------------------
one
two
three
four
five
six
seven
eight
nine
ten
Eleven
twelve
..
..
..
98
Nineteen eighty
Cent100 selected lines.
-
Need to use values from the first query in other queris to the data model
Hello
Here is my requirement-
I use the data model to run multiple queries. The first query, I get 10 records. Now, I want to use these 10 records in the second query to get my final result. I am not able to use the sub query as the two motions are quite long and complex.
Select distinct Bishop of emp
Select empno, emp where Bishop in (: Bishop)
I can't use: Bishop because it will give only the last value stored at Archbishop. Is it possible to be able to use all the values from the first query in the second query using the data model?Hello
Are you sure that you have your "dataStructure" configured correctly? Try this simple example:
Hope this helps
Andy
-
Insert the date value in a table
Hello
I tried to update a table to insert the date in a date field. while I am running the query, it throws an error message like:
"
ORA-01830: date format picture ends before converting all of the input string
01830.00000 - "date format picture ends before converting all of the input string.
* Cause:
* Action:
"1830Error salesperson online: 1.
My update query is added under:
UPDATE PS_OBJCMTP_TMP SET LASTUPDOPRID = "PPLSOFT", LASTUPDDTTM = TO_DATE ('02-11 - 2002-12.14.09.000000 ',' YYYY-MM-DD - HH24.MI.) SS') WHERE OBJECTID1 = 3 AND OBJECTVALUE1 = 'EDIMAPPROPOP' AND OBJECTID2 = 0 AND OBJECTVALUE2 = '' AND OBJECTID3 = 0 AND OBJECTVALUE3 =' ' AND OBJECTID4 = 0 AND OBJECTVALUE4 = ' '
someone tell me how to solve this problem.Simply speaking, you should cut ' 2002 - 02 - 11 - 12.14.09.000000'-' 2002 - 02 - 11 - 12.14.09'.
RPAD('2002-02-11-12.14.09.000000',19) -
Insert the data in the table another table
Hi experts,
I am currently using the version below:
My requirement is to insert a table of data in the other table.Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production PL/SQL Release 11.2.0.1.0 - Production CORE 11.2.0.1.0 Production TNS for 32-bit Windows: Version 11.2.0.1.0 - Production NLSRTL Version 11.2.0.1.0 - Production
Table 1:
Table 2:create table a (a1 number); insert into a values (1); insert into a values (null); insert into a values (3);
I wrote the code to insert the lines below.CREATE TABLE c (b1 number not null); Note : table c have b1 column with not null constraint
He insert 1 row, then after I get the error message like: 01400. 00000 - "impossible to insert a NULL value in (%s)."declare v_a1 a.a1%TYPE; CURSOR c1 IS SELECT a1 FROM a; BEGIN OPEN c1; for i in 1..3 loop FETCH c1 INTO v_a1; EXIT WHEN c1%notfound; INSERT INTO c values(v_a1); commit; end loop; close c1; end;
But I want the output as:
Please give the solution to the prescription above.SELECT * FROM c; OUTPUT : 1 3
Thank youI think you are looking for DML ERROR LOGGING
SQL> desc a_tab Name Null? Type ----------------------------------------------------- -------- ------------------------------------ COL1 NUMBER COL2 NUMBER COL3 NUMBER COL4 NUMBER SQL> desc b_tab Name Null? Type ----------------------------------------------------- -------- ------------------------------------ COL1 NOT NULL NUMBER COL2 NOT NULL NUMBER COL3 NUMBER COL4 NUMBER SQL> execute dbms_errlog.create_error_log('b_tab', 'b_tab_err') PL/SQL procedure successfully completed. SQL> desc b_tab_err Name Null? Type ----------------------------------------------------- -------- ------------------------------------ ORA_ERR_NUMBER$ NUMBER ORA_ERR_MESG$ VARCHAR2(2000) ORA_ERR_ROWID$ ROWID ORA_ERR_OPTYP$ VARCHAR2(2) ORA_ERR_TAG$ VARCHAR2(2000) COL1 VARCHAR2(4000) COL2 VARCHAR2(4000) COL3 VARCHAR2(4000) COL4 VARCHAR2(4000) SQL> insert into b_tab(col1, col2, col3, col4) 2 select col1, col2, col3, col4 3 from a_tab 4 log errors into b_tab_err('my_test') reject limit unlimited; 2 rows created. SQL> select * from b_tab; COL1 COL2 COL3 COL4 ---------- ---------- ---------- ---------- 1 2 3 4 6 8 4 9 SQL> set serveroutput on SQL> SQL> exec dev_util.print_table('select * from b_tab_err') ------------------------------------------------------- Field Name Field Value ------------------------------------------------------- ORA_ERR_NUMBER$ : 1400 ORA_ERR_MESG$ : ORA-01400: cannot insert NULL into("ARBORU"."B_TAB"."COL2") ORA_ERR_ROWID$ : ORA_ERR_OPTYP$ : I ORA_ERR_TAG$ : my_test COL1 : 5 COL2 : COL3 : 3 COL4 : 6 ------------------------------------------------------- Field Name Field Value ------------------------------------------------------- ORA_ERR_NUMBER$ : 1 ORA_ERR_MESG$ : ORA-00001: unique constraint(ARBORU.SYS_C00658187) violated ORA_ERR_ROWID$ : ORA_ERR_OPTYP$ : I ORA_ERR_TAG$ : my_test COL1 : 1 COL2 : 9 COL3 : 9 COL4 : 0 PL/SQL procedure successfully completed. SQL>
-
common to the appellants for 3 days from particular date
Need to find the number of other_party which is a common call for conseutive 3 days
Create table call (key id Number (15) not null, mobile_number number primary (10), other_party number (10), call_type varchar2 (10), the call_date_time date, number (15)) duration;
insert into values of the call (1,9818764535,9899875643, 'IN', to_date (24 May 12 02:10:43 "," dd-MON-yy hh24:mi:ss'), 10);
Insert in appeal values (2, 9818764535,9215478213, 'OUT', to_date (24 May 12 08:11:13 "," dd-MON-yy hh24:mi:ss'), 20);
Insert in appeal values (3, 9818764535,9899875643, 'IN', to_date (25 May 12 18:07:02 "," dd-MON-yy hh24:mi:ss'), 30);
insert into values of the call (4,9818764535,9012451785, 'IN', to_date (26 May 12 02:11:13 "," dd-MON-yy hh24:mi:ss'), 40);
Insert in appeal values (5, 9818764535,9215478213, 'IN', to_date (26 May 12 08:17:02 "," dd-MON-yy hh24:mi:ss'), 25);
Insert in appeal values (6, 9818764535,9899875643, 'OUT', to_date (26 May 12 20:21:04 ',' dd-MON-yy hh24:mi:ss'), 67);
Entry criteria:
Mobile phone number: 9818764535
date: 24 April 13
Output:
Other_party call_type time call_date_time
9899875643 IN 24 APRIL 13 02:10:43 10
9899875643 ON APRIL 25, 13 18:07:02 30
9899875643 ON 26 MAY 13 20:21:04 67
Published by: 983567 on May 2, 2013 03:51
Published by: 983567 on May 2, 2013 03:52Hello
983567 wrote:
Need to find the number of other_party which is a common call for conseutive 3 daysCreate table call (key id Number (15) not null, mobile_number number primary (10), other_party number (10), call_type varchar2 (10), the call_date_time date, number (15)) duration;
insert into values of the call (1,9818764535,9899875643, 'IN', to_date (24 April 13 02:10:43 "," dd-MON-yy hh24:mi:ss'), 10);
Insert in appeal values (2, 9818764535,9215478213, 'OUT', to_date (24 April 13 08:11:13 "," dd-MON-yy hh24:mi:ss'), 20);
Insert in appeal values (3, 9818764535,9899875643, 'IN', to_date (25 April 13 18:07:02 "," dd-MON-yy hh24:mi:ss'), 30);
insert into values of the call (4,9818764535,9012451785, 'IN', to_date (26 May 13 02:11:13 "," dd-MON-yy hh24:mi:ss'), 40);
Insert in appeal values (5, 9818764535,9215478213, 'IN', to_date (26 May 13 08:17:02 "," dd-MON-yy hh24:mi:ss'), 25);
Insert in appeal values (6, 9818764535,9899875643, 'OUT', to_date (26 May 13 20:21:04 ',' dd-MON-yy hh24:mi:ss'), 67);AE there no set of 3 days of consctuive in the sample data.
Did you mean to say "APR" everywhere, you said 'MAY' above?Entry criteria:
Mobile phone number: 9818764535
date: 24 April 13Output:
Other_party call_type time call_date_time
9899875643 IN 24 APRIL 13 02:10:43 10
9899875643 ON APRIL 25, 13 18:07:02 30
9899875643 ON 26 MAY 13 20:21:04 67Here's one way:
WITH params AS ( SELECT 9818764535 AS mobile_number , DATE '2013-04-24' AS start_date FROM dual ) , got_cnt AS ( SELECT c.* , COUNT (DISTINCT TRUNC (c.call_date_time)) OVER ( PARTITION BY p.mobile_number , p.start_date , c.other_party ) AS cnt FROM params p JOIN call c ON c.mobile_number = p.mobile_number AND c.call_date_time >= p.start_date AND c.call_date_time < p.start_date + 4 ) SELECT * -- or list columns wanted FROM got_cnt WHERE cnt = 3 ;
You can search for 2 or more distinct (mobile_number, start_date) target in the same query, if you wish.
It is easy to make consecutive (3) the number of days in this case a parameter. -
Doubt by inserting the Date and time in the table
Hi I created a table with two columns "Order_ID" and "Order_date" as
create table test
(
whole order_id,
ORDER_DATE date default sysdate
);
Now, I insert a line in the
insert into test (order_id) values (1);
now, I get the result as
ORDER_ID ORDER_DAT
------------- --------------
1 JUNE 5, 12
But I need to insert the time current system also in the Order_date column.
How can I achieve this?It works well for me!
bcm@bcm-laptop:~$ sqlplus user2/user2 SQL*Plus: Release 11.2.0.1.0 Production on Mon Jun 4 20:19:57 2012 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options 20:19:58 SQL> @test1 20:20:01 SQL> create table test1 20:20:01 2 ( 20:20:01 3 order_id integer, 20:20:01 4 order_date date default sysdate 20:20:01 5 ); Table created. 20:20:01 SQL> 20:20:01 SQL> insert into test1(order_id) values(1); 1 row created. 20:20:01 SQL> select * from test1; ORDER_ID ORDER_DATE ---------- ------------------- 1 2012-06-04 20:20:01 20:20:01 SQL>
-
Using the cursor to insert a value
Hello
I created a procedure mentioned below, using the slider that I want to insert a value in the table its not to insert any value. You can one to find the solution. I have compiled the procedure there is no errors...
I have a lot of value in the employee... then after table do not perform the procedures no value in employee_lkp
My structure from the Employee table is
CREATE TABLE 'VIDHYA '. "' EMPLOYEE '.
(
VARCHAR2 (15 BYTE) "PNOM."
'MINIT' VARCHAR2 (2 BYTE),
VARCHAR2 (15 BYTE) "LNAME",.
ACTIVATE THE "SSN" NUMBER (12.0) NOT NULL,
"BDATE" DATE,
'ADDRESS' VARCHAR2 (35 BYTE),
'SEX' VARCHAR2 (1 BYTE),
ACTIVATE THE "WAGES" NUMBER (7,0) NOT NULL,
NUMBER (12.0) "SUPERSSN."
ACTIVATE THE 'DNO' NUMBER (2.0) NOT NULL,
ACTIVATE THE STATISTICS STORAGE CALCULATION (INITIAL 65536 THEN 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 USER_TABLES DEFAULT TABLESPACE) 'USERS' CONSTRAINT 'PK_EMPLOYEE' KEY PRIMARY ("SSN") WITH THE HELP OF INDEX PCTFREE 10 INITRANS MAXTRANS 255 2.
CONSTRAINT 'FK_DEPARTMENT' FOREIGN KEY ('DNO') REFERENCES 'VIDHYA '. "" DEPARTMENT "("DNUMBER") ALLOW
)
employee_lkp structure is
CREATE TABLE 'VIDHYA '. "" EMPLOYEE_LKP ".
(
VARCHAR2 (250 BYTE) "PNOM."
VARCHAR2 (250 BYTE) "LNAME",.
'ID '.
)
create or replace
procedure employeelkp is
number of add_val;
i the number;
number num.
add_name cursor is select * from employee;
name_cur add_name % rowtype;
Start
Open add_name;
Select count (*) in the number of the employee;
because me in 1.num
loop
extract the add_name in name_cur;
insert into employee_lkp (id, fname, lname)
values (i,
name_cur. Lname,
name_cur.fname);
When the output add_name % notfound;
end loop;
close add_name;
end employeelkp;Try this...
Addcommit;
After
close add_name;
at the bottom.
I hope this helps...
Hamid
-
DECODE() using Insert the DATE field
I am trying to use the DECODE function to test for NULL before you insert a DATE field. However, it seems only to insert the DATE, with a time of 'default' from 12:00 - it is not inserted properly the time.
Basically, I need to test if Date1 is NULL. If not I need to concatenate the Date1 DATENT with TIME of Date2 to get a complete date/time... and then insert this new value.
Generic example:
-----
CREATE TABLE DATETEST (TestID NUMBER (1), DATE TestDate);
-----
DECLARE
DATE of v_Date1;
DATE of v_Date2;
BEGIN
v_Date1: = TO_DATE (1 Jan 11 05:53:12 ',' DD-MON-YY hh);
v_Date2: = TO_DATE (8 February 11 02:18:31 ',' DD-MON-YY hh);
INSERT IN DATETEST (TestID, TestDate) VALUES ('1', DECODE (v_Date1, NULL, NULL, TO_DATE (To_Char (v_Date1, 'DD-MON-YY') |))) ' ' || To_char(v_Date2, 'HH:mi:SS'), 'DD-MON-YY HH')));
INSERT IN DATETEST (TestID, TestDate) VALUES ('2', TO_DATE (To_Char (v_Date1, 'DD-MON-YY') |)) ' ' || To_char(v_Date2, 'HH:mi:SS'), 'DD-MON-YY HH'));
END;
-----
SELECT TestID, TO_CHAR (TestDate, ' DD-MON-YY hh) from DATETEST;
-----
The following example performs two inserts. With the DECODE function and the other without. One without inserts the time correctly. Can someone tell me why with the DECODE function do? I know I can use a simple if/then to check if the date is null above and put the time in a variable, but since my real scenario is in a lot of other things, I'm trying to keep it as simple as possible.
Published by: BoredBillJ on July 14, 2011 06:39INSERT INTO DATETEST( TestID, TestDate ) VALUES( 1, TRUNC(v_Date1) + (v_Date2 - TRUNC(v_Date2)) ) /
SY.
-
Insert the Date and time of the questions
Hi all
I have a simple select query as follows... UPLOAD_DATE stands to table1 in the following format: 23/01/2012-13:04:36
< name cfquery = 'test' datasource = 'test' >
SELECT UPLOAD_DATE
FROM TABLE1
< / cfquery >
and I have a loop around the query above to insert into another table...
< cfloop query = 'test' >
< cfquery name = "make_tfer2" datasource = 'test' >
INSERT INTO TABLE2
(UPLOAD_DATE)
VALUES
(#test. UPLOAD_DATE #)
< / cfloop >
< / cfloop >
But, when I insert into table2 it inserts the release date: 23/01/2012... How can I fix this code so I can insert the release date: 23/01/2012-13:04:36?
Your approach is ineffective. Instead of a loop in the results of the query and make individual inserts, make a single sql insert.
Insert into table2
Select all that
FROM table1
For your post at 04:48, of course there is no component "hour". The example you showed has time 00:00.
-
can we write the value of a data element that is not displayed in a form?
Hello
I work with Oracle 9i forms developer. While the practice sessions, I'm for any writing a value to a data element that is not displayed in the forms. can I do it or not? for example: to insert the value into the field the orders of the form module (orders.fmb) order_information table order_total. This table can be found in the oe schema.
I think you understood my question.
Please help me.Yes. It is because the article in this form is always calculated and not extracted from the base. To write to the database, put an extra point for the total in your block and CONTROL integration prior and PRE-UPDATE-trigger, assign the value of the element automatically calculated in the control block for the item in the CONTROL unit, as
:ORDER.TOTAL:=:CONTROL.TOTAL;
-
Insert the statement do not using the MultiSelect values correctly
I have a set of boxes MultiSelect displayed with in a cfloop. I named the MultiSelect boxes "MultiSelect #ID # with #ID #
the value of KP for each record retrieved. I do this to make sure that each MultiSelect box has a unique name so that when I
Insert data by using a query of < cfloop > names of are not in conflict. Here's the HTML for the selectbox.
< select name = "" MultiSelect #ID # ' several size = "3" > (query #ID 'getNonRoleItemDetails) "
< cfloop query = "getMultiitems" >
< option value = "#AddInfoID #" > #Name # < / option > (these two values are taken from the "getMultiItems" query
< / cfloop >
Here's the query insert I use on the action page that uses this data.
< cfloopquery getNonRoleItemDetails >
< cfquery = name "Datasource =' #application.dbname # of the Insert_Multi_Records" >
INSERT INTO tblItemDetailUpdates (ItemID, ItemDetailsListID, ItemDetailValue, ActionItemID)
VALUES (#getNonRoleItemDetails.ItemID #, #getNonRoleItemDetails.ID #, ' #form ["MultiSelect" & ID] #', #ArrayOfIds [Counter] #)
< / cfquery >
< / cfloop >
The problem I have here is that the query works correctly, but it is the insertion of the ID MultiSelect values selected (104, 105,
(106), rather than the real names of these values (IOC, AP, AR... etc).
I looked at the source code and each MultiSelect box is named correctly and uniquely. Insert inserts the correct ID
values, but not the names.Sigh too bad I am a fool. Well at least I thought about it.
-
Inserting the object in a datagrid data
Hi guys.
I'm building a flex application with data from webservice. The result of the Web service looks like to stuck the coded in at the buttom.
An array of person objects each with a unique inside info-object. Everything is right for the part firstname and lastname, I can use the following code - where event.result is the answer of my webservice:
var arrResult:ArrayCollection = new ArrayCollection();
arrResult.source = event.result.toArray ();
DG1. DataProvider = arrResult;
firstnameField.dataField = "first name";
lastnameField.dataField = "name";
But what happens if I want to insert the phone number in the 3rd column called phoneField? I like to use:
phoneField.dataField = "Info.Phone"; Does not...
but this does not work, I guess that's because flex does not know if there is one or 10 info-objects inside each person object.
So, how can I do?
I see that I can use Person (arrResult.getItemAt (0)). Info.Phone to retrieve the value of the object-specific one (the first in the result here, but how to fill in all the for each person in the grid?)
Thanks in advance.
/ Nibby"Myonlycrummynick" wrote in message
News:gli9f9$APQ$1@forums. Macromedia.com...
> Hi guys.
>
> I'm building a flex application with data from webservice. The
> result
> Web service looks like to stuck the coded in at the buttom.
>
> Array of person objects each with a unique inside info-object. All the
> is
> good for the firstname and lastname part, I use the following code.
> where
> event.result is the answer of my webservice:
>
> var arrResult:ArrayCollection = new ArrayCollection();
> arrResult.source = event.result.toArray ();
> dg1.dataProvider = arrResult;
> firstnameField.dataField = "first name";
> lastnameField.dataField = "name";
>
> But what happens if I want to insert the phone number in the 3rd column called
> phoneField? I like to use:
>
> phoneField.dataField = "Info.Phone"; Does not...Try rather labelFunction.
HTH;
Amy
Maybe you are looking for
-
Toshiba 32PU200EJ - HDMI port does not signal
My toshiba TV series 32PU200EJ unable to connect to the HDMI port,last week, it was OK, I use it just for the PS3 game.When I try to connect the HDMI to PS3 or laptop, it says "unsupported SIGNAL". ANYONE can help with this problem? Thanks :)
-
Is there a manual installation of XP for Satellite P200 - 1 FT (PSPB6)
HelloTwo months ago, I've decided to review the Satellite P200 - 1 FT (PSPB6).I already asked toshiba support if I could install Windows XP Professional.They said yes, so I tried to install windows XP now. But then the problems arrived.XP works but n
-
ReadyNASOS 6.4.0 - T127 (Beta 3) on Readynas Pro 6
Guys, I just installed last 6.4.0 beta branch. I've noticed that disk numbers are not displayed on chassis display upwards. Only squares are shown but not number inside them. I think it is a bug. Good bye
-
Upgrade of the internal speakers not working not not after El Capitan
The internal speaker have disappreared after upgrade to 10.11.2 Beta (15C48a) since beta 1 speaker and the sound does not work. My system: 5 K, 27 inch, mid-2015) 3.3 GHz Intel Core i5 32 GB 1600 MHz DDR3? Having tried everything, someone at - it ano
-
Do not delete email from Yahoo of blackBerry Smartphones
I've had my turn for a few weeks and had a Peral before that and never had this problem. I don't know when he started as I don't check my email every day. I get all my pop3 emails on my phone but when I choise to delete the message "on the mailbox