increase the value of minute in 14 minutes, while the data is inserted into the table
HelloI'm having the asp page that connects with the DB to insert values into the table. One column is date data type. Value from this asp page must be incremented to 14 minutes before be inserted into the table.
How can I do this?
sqlG="INSERT INTO AEMU " &_
" (MSISDN,X,Y,TIME_STAMP,REQ_ID, " &_
" COUNTRY_G)" &_
" VALUES " &_
"('"& msid &"'," &_
"'" & X & "'," &_
"' " & Y & " '," &_
"to_date('" & Day(TrueTimeStamp) & "-" & MonthName(Month(TrueTimeStamp), True) & "-" & Year(TrueTimeStamp) & " " & Hour(TrueTimeStamp) & ":" & Minute(TrueTimeStamp) & ":" & Second(TrueTimeStamp) & "', 'DD-MON-YYYY HH24:MI:SS')," &_
"' " & req_id & " '," &_
"'" & CountryName_G & "')"
Try this way:
sqlG="INSERT INTO AEMU " &_
" (MSISDN,X,Y,TIME_STAMP,REQ_ID, " &_
" COUNTRY_G)" &_
" VALUES " &_
"('"& msid &"'," &_
"'" & X & "'," &_
"' " & Y & " '," &_
"to_date('" & Day(TrueTimeStamp) & "-" & MonthName(Month(TrueTimeStamp), True) & "-" & Year(TrueTimeStamp) & " " & Hour(TrueTimeStamp) & ":" & Minute(TrueTimeStamp) & ":" & Second(TrueTimeStamp) & "', 'DD-MON-YYYY HH24:MI:SS')+14/(24*60)," &_
"' " & req_id & " '," &_
"'" & CountryName_G & "')"
Max
[My Italian blog Oracle | http://oracleitalia.wordpress.com]
Tags: Database
Similar Questions
-
Insert into a table using the check boxes
Hello
I want to insert into a table emp when I press a button "Insert" area of employee report. the SQL query for the report is
SELECT HTMLDB_ITEM. CheckBox(1,rowNum) "",
x.EmpNo,
x.Ename
de)
Select empno htmldb_item.hidden(2,empno),
htmldb_item. Text(3,Ename) ename from emp) x
order by 2
I created the following process:
declare
v_test varchar (10);
Start
BECAUSE me in 1.HTMLDB_APPLICATION. G_F01. COUNTY
LOOP
v_test: = HTMLDB_APPLICATION. G_F02 (HTMLDB_APPLICATION. G_F01 (i));
dbms_output.put_line (v_test);
insert into emp(empno,ename,job,mgr,hiredate,sal,comm,deptno)
values(v_test,'A','B',10,01-May-81,200,1,10)
WHERE empno = HTMLDB_APPLICATION. G_F02 (HTMLDB_APPLICATION. G_F01 (i));
END LOOP;
end;
But IT is not working properly, infact, it gives me errors like:
ORA-06550: line 9, column 47:
PL/SQL: ORA-00933: SQL not correctly completed command
ORA-06550: line 8, column 1:
PL/SQL: SQL statement ignored
7 dbms_output.put_line (v_test);
8 insert into emp (empno, ename, job, mgr, hiredate, sal, comm, deptno)
9 values(v_test,'A','B',10,01-MAY-81,200,1,10)
10 WHERE empno = HTMLDB_APPLICATION. G_F02 (HTMLDB_APPLICATION. G_F01 (i));
11. END OF LOOP;
Any help?
Additional info: table Emp is the default table in the databaseThis is an example showiing how such a process must be put in place:
http://Apex.Oracle.com/pls/OTN/f?p=31517:95
Denes Kubicek
-------------------------------------------------------------------
http://deneskubicek.blogspot.com/
http://www.Opal-consulting.de/training
http://Apex.Oracle.com/pls/OTN/f?p=31517:1
------------------------------------------------------------------- -
I have two tables (2) RESULT TAB (1)
CREATE TABLE TAB
(
NUMBER OF SNO
A NUMBER,
B THE NUMBER.
NUMBER OF THE SUM
);
CREATE AN ARRAY OF RESULT
(
NUMBER OF SNO
NUMBER OF THE SUM
)
my doubt is:
(1) I want to insert a table TAB, my question is how to insert a column to the SUM using the column A AND B... Here im adding two values of the column and store result in the AMOUNT column.
SNO A B SUM
1 100 150 250
2 300 100 400
I want to like this, it is possible with single insert query?
(2) at the time of the insertion TAB of values that SNO, and the values of table TAB $ insert in the table of RESULTS... is it possible these two inserts at the same time?
in fact, im using another this table.fro TAB and easy to understand I write like that, please solve this problem
First, you post in the wrong forum as this one is only for Oracle's SQL developer tool. So you might ask your question in the general forum of SQL.
Second, you might solve your problems with bind variable:
Insert tab
(sno, a, b, sum)
values
(: SNO,: A: B: A + B :))
You should not use sum as column name because it is a reserved word.
More you cannot insert into two different tables with a single SQL, but you can use PL/SQL to do this:
Start
insert into tab values (: SNO,: A: B: A + B :);)
insert into result values (: SNO,: A + B :);)
end;
If you meet sno from a sequence, you could do something like this:
Start
insert into values tab (seq_sno.nextval,:,: B,: A +: B) return sno in: SNO.
insert into result values (: SNO,: A + B :);)
end;
Hope that helps,
dhalek
-
Validate values inserted into a table against an another record in the table.
Hi, I have this two tables on my Oracle Database 10g:
and what I have to do is to make sure that you can only insert a record if the [wheel, hood, bumper, radiator etc...] values are values that already exist in the State of the table, but I do not know if you add FK as:Status Id_Status | Description -------------------------------- 102 | Ok 123 | Damaged 345 | Broken Cars Car_ID| wheel | hood | bumper | radiator ------------------------------------------------- 1 | 1 | 2 | 2 | 3
is the right way to do it.ALTER TABLE "RCVRY"."COMPANY" ADD (CONSTRAINT "CITY_ID" FOREIGN KEY("STATE") REFERENCES "RCVRY"."CITIES"("STATE")
If anyone can help by providing code samples or pointing to the right place in the documentation to look out it will be greatly appreciated.
Concerning
JMHPHello
José M. Hurtado says:
Hi, I have this two tables on my Oracle Database 10g:Status Id_Status | Description -------------------------------- 102 | Ok 123 | Damaged 345 | Broken Cars Car_ID| wheel | hood | bumper | radiator ------------------------------------------------- 1 | 1 | 2 | 2 | 3
and what I have to do is to make sure that you can only insert a record if the [wheel, hood, bumper, radiator etc...] values are values that already exist in the State of the table, but I do not know if you add FK as:
ALTER TABLE "RCVRY"."COMPANY" ADD (CONSTRAINT "CITY_ID" FOREIGN KEY("STATE") REFERENCES "RCVRY"."CITIES"("STATE")
is the right way to do it.
Yes, foreign keys are the right way to do it.
Make sure that first of all, there is a constraint of PRIMARY KEY (or UNIQUE) on status.id_status.If anyone can help by providing code samples or pointing to the right place in the documentation to look out it will be greatly appreciated.
The code you have posted has an imbalance ' (' between ADD and CONSTRAINT.) Lose that ' (' and you have the right syntax.)
Double quotes are necessary only if you use non-standard names. Do not.
The schema name (RCVRY in the above example) is optional.So, you could say:
ALTER TABLE cars ADD CONSTRAINT cars_wheel_fk FOREIGN KEY (wheel) REFERENCES status (id_status) ;
I hope that answers your question.
If this is not the case, after a test script.
Publish instructions CREATE TABLE for tables and ALTER TABLE instructions for constraints (if they are not part of the CREATE TABLE statements).
Let's just do the constraint on wheel first. Once you know how to do this, add similar constraints for the other columns (radiator, hood, bumper,) will be easy.
After a series of INSERT statements (and update, if you want) for the two tables, which must be executed in order.
Say if you want as each INSERT (or UPDATE) statement of work or not. (Include a few of them).Published by: Frank Kulash, December 7, 2010 19:15
-
to increase the table to correct the mistake of cobol
Hello
people 8.49 soft under Win server 2003, we have this error message for sql Cobol:
Can you please expose me what could be the problem and that the table and how to be extended?Internal array overflow occurred for array %1 defined in copybook %2 with a max array count of %3
Thank you very much.Take a look on
https://metalink3.Oracle.com/od/faces/secure/km/DocumentDisplay.JSPX?ID=612572.1&h=Y
Thank you!!
-
How to identify the name of the procedure that inserts into a table in the TRIGGER
Hello
There are several procedures in my DB that perform the INSERT operation on a main table - MYTAB say.I created a trigger on the table MYTAB, to follow closely, what procedure is insert data in there. Is there a function that captures the name of this object?
For example: PROC_A, PROC_B, PROC_C insert into the table MYTAB. And my query is - the trigger on table MYTAB should document these object names where the lines fit.
Please let me know your suggestions...SQL> create table t (no integer, dt timestamp, who_inserted varchar2(4000)); Table created. SQL> create or replace procedure p 2 as 3 begin 4 insert into t (no, dt) values (1, systimestamp); 5 end; 6 / Procedure created. SQL> show err No errors. SQL> create or replace trigger t_trig before insert on t for each row 2 begin 3 :new.who_inserted := dbms_utility.format_call_stack; 4 end; 5 / Trigger created. SQL> show err No errors. SQL> begin 2 p; 3 end; 4 / PL/SQL procedure successfully completed. SQL> select * from t; NO DT WHO_INSERTED ---------- ------------------------------ ---------------------------------------- 1 31-OCT-14 04.58.53.668465 AM ----- PL/SQL Call Stack ----- object line object handle number name 3a7ddbea0 2 KARTHICK.T_TRIG 3ac979f30 4 procedure KARTHICK.P 3a822deb8 2 anonymous block
-
Use the trigger and seq to insert into 2 tables
I created a sequence.
I have 2 tables
I want a trigger that when I insert in the 1 table inserts the sequence number nextval, that is no problem, but also is there a way so that once that happens it also inserts this same value of sequence in another table.
So the end result is a new record in the table has the seq value and a new record in table b with the same value of seq (and the rest of the fields blank)
Thanks for any help
Could do:
SQL > create the sequence myseq;
Order of creation.
SQL > drop table t2 is serving;
Deleted table.
SQL > drop table t1 is serving;
Deleted table.
SQL > create table t1 (collar number);
Table created.
SQL > create table t2 (collar number);
Table created.
SQL > create or replace trigger mytrig
2 before the Insert on t1
3 for each line
4 start
case 5: new.col is null
6. can
7: new.col: = myseq.nextval;
8 insert into t2 (col)
9. Select myseq.currval
10 double;
11 end if;
12 end;
13.
Trigger created.
SQL > insert into values (null), t1 (col);
1 line of creation.
SQL > select * from t1;
COL
----------
1
1 selected line.
SQL > select * from t2;
COL
----------
1
1 selected line.
-
Select the statement to insert into a table by using a loop
Hello
what I want to do is create 3 records based on this one in a loopcreate table uploadtab( itema varchar2(3), xtype varchar2(1), salesa number, margina number, salesb number, marginb number, salesc number, marginc number); insert into uploadtab (itema, xtype, salesa, margina, salesb, marginb, salesc, marginc) values ('abc', 'a', 100, .40, 300, .10, 450, .25); create table testinsert(itema varchar2(3), xtype varchar2(1), sales number, margin number);
so here's my desired for testinsert output
I don't want to use 3 insert tables if possibleabc a 100 .40 abc a 300 .10 abc a 450 .25
any help would be greatly appreciated
Thanks in advance
Published by: DM on July 7, 2010 14:22This gives a shot:
INSERT INTO testinsert ( itema , xtype , sales , margin ) SELECT itema , xtype , DECODE ( RN , 1,salesa , 2,salesb , 3,salesc ) , DECODE ( RN , 1,margina , 2,marginb , 3,marginc ) FROM uploadtab CROSS JOIN ( SELECT ROWNUM RN FROM dual CONNECT BY LEVEL <= 3 ) ;
-
Insert into multiple tables; Enter the id of the first
I apologize if this has been answered elsewhere, but I tried searching and got no results.
I try inserting the contents of a form in two tables. After you insert fields in a table, I want to enter the id of the first table key in the second table with the other fields.
I tried a few different things, including trying to use SCOPE_IDENTITY(), but just kept a lot of mistakes.
The current version of my code works perfectly, * except for the fact that it does not insert the ID *!
Can someone tell me what I am doing wrong? or offer another way to do this?
Thanks for your help, as usual.
Very well! I got it to work. Thank you very much! Here's what I ended up doing (I write just the code for INSERTs). I'll play with cfqueryparam some more later - thanks a lot for the valuable info!
-
Before file is deleted, the record must be insert into another table
Hi friends,
I have to create tabular form to delete some record. Using this tabular form I deleted successfully.
But I want to when I delete a record before deleting record that he should go to another table.
How can I do that.
EdHello
You create before you remove the trigger table.
http://download.Oracle.com/docs/CD/B10500_01/server.920/a96524/c18trigs.htmBR, Jari
-
How to set the default on a table when data is inserted in another table
Hi all
I use Jdeveloper 11.1.1.2 and ADFBC.
I have two tables and tableA, tableB.
I wish that when I insert a line in tableA, automatically, a row is inserted in tableB.
How can I do? Creating a java class for tableA OS? How can I reference/create a line in the area of occurrence of another table?
Thank you
AndreaWhen you want that to happen... If you want to occur when you run the page, then have it in the getter()... If you like... When you set it... then's it in the Set accessor... You manually assign the id. or is he from any order?
-
Increase the size of virtual disk Volume
If initially, I create a RAID10 array with four drives and install ESX3i, then later add two drives to increase the size of the RAID10 array, I can use the extra space for VMS ESX3i without erasing the data?
Thank you!
Bob HHSU
RAID10 on RAID5 due to performance. I 4x500Gb then RAID10 gives me about 1 TB usable, that should be enough space for a couple of years for my application
Okay, maybe that's true, but you are only working with a few axes. RAID 10 in maybe 20 disks RAID 10 is perhaps better performance, but not big thing with only 2 pins. If you don't have the space, very well. I hope it works for you.
In addition, the machine has six spans and so I have the ability to add more than two readers and increase the table to about 1.5 TB. My dilemma is now maybe I should add plus two other readers from the beginning if ESX cannot cultivate virtual disks.
OK, then if you have disks now, why don't put you in now. Even if you can grow the disk later, why re-work. This seems really odd. Do everything now and do it. If you do not have to do it later.
VM the VMFS, correct? If I have too much space allocated to a virtual computer and he needs for another, I can reduce the allocation?
Yes, but again, it is more work. Start small. It is easier to add than SUBTRACT. Start with only 50 GB, 100 GB. OS file systems growth is much easier, the fight must convert a copy of the SAME virtual machine, which requires even more work...
-
Auto refreshing display objects when the new line in the table inserted on another computer
Greetings,
I'm using an application of ADF JDeveloper 11.1.2.4.0 its been used by 2 separate computers.
It's the same application, but I shared with security ADF for the person (Secretary) will see the half view of the application
and the other person (doctor), the other half seen. Basically, I put adf username expression (rendering) for each display mode
the specific menu, buttons, tabs, etc.
My problem is, say the Secretary, creates a doctor's appointment, rather than re - run display objects
every X minutes on the advice of the doctor, is there a way to notify the application that the new data are inserted into the database and must be re/refresh-execute?
I have about 100 objects from view and I don't want to discount/re-execute all objects from view because I don't know on what table a new record its been inserted.
Appointment is just one example, there are many paintings that both views are connected to.
Hello
Here is the solution to your needs: http://matthiaswessendorf.wordpress.com/2010/01/22/flexible-active-data-service/.
Instead of the pop-up window in the sample you would be re - run the table of appointment. Now all you need is a mechanism that informs the change, which may be a trigger in the database or application that updates the new appointment
Frank
-
Outer join - problem with the name of the table in the select list
Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production
create table (j1)
number of C1,
number of C2);
create table (j2)
number of C1,
number of C2);
insert into values j1 (1, 10);
insert into j1 values (1, 100);
insert into values j1 (1, 1000);
insert into values j2 (1, 2);
insert into values j2 (1, 4);
insert into values j2 (1, 8);
commit;
Select c1, j1.c2, j2.c2 of outer join of j1 j2 using (c1); - DOES NOT
Select c1, j1 j2 (c1) using outer join j2.c2. - WORK
Why?
Hello
Interesting question! Oracle goes very far in trying not to trigger an error.
The OUTER keyword (if used; it is always optional) must be preceded by one of the keywords, right or LEFT. Since neither LEFT, RIGHT, or FULL comes before OUTER in queries in your first message, it does not recognize as keyword OUTER and treats him like a table alias for table j1. Since j1 has an alias, the real table name cannot be used in the SELECT clause. This query is executed:
SELECT c1
outer.c2
j2.c2
External J1
Join the HELP of j2 (c1)
;
There is an INTERNAL join. Add to your sample data:
insert into values of j1 (-1, -10);
insert into values of j2 (-2, -20);
to be specified.
Moreover, USING is short for confUSING. I suggest you use IT for all the join conditions. Everyone (unless they you write or read a manual) does.
-
In BULK COLLECT IN the Table "Record".
Hello
I can't find a solution for this case. I try to extract the data in an array of different records with subtype records.
-Table example:
CREATE THE TABLE1 TABLE:
("COLUMN1" NUMBER,
"COLUMN2" NUMBER,
"COLUMN3" NUMBER,
"COLUMN4" NUMBER,
COLUMN '5' NUMBER,
"COLUMN6" NUMBER
);
-Sample data:
INSERT INTO TABLE1 (COLUMN1, COLUMN2, COLUMN3, COLUMN4, COLUMN 5, COLUMN6) VALUES ('11', '12', '13', '14', 15', 16');
INSERT INTO TABLE1 (COLUMN1, COLUMN2, COLUMN3, COLUMN4, COLUMN 5, COLUMN6) VALUES ('21', '22', '23', '24', 25', 26');
INSERT INTO TABLE1 (COLUMN1, COLUMN2, COLUMN3, COLUMN4, COLUMN 5, COLUMN6) VALUES ('31', '32', '33', '34', 35', 36');
INSERT INTO TABLE1 (COLUMN1, COLUMN2, COLUMN3, COLUMN4, COLUMN 5, COLUMN6) VALUES ('41', '42', '43', '44,' 45', 46');
INSERT INTO TABLE1 (COLUMN1, COLUMN2, COLUMN3, COLUMN4, COLUMN 5, COLUMN6) VALUES ('51', '52', '53', '54,' 55' 56');
Here, I stated some of the columns of the table as individual records / use in the RETURN of some of the features clause.
DECLARE
TYPE t_col_group1 IS RECORD (col2 of TABLE1. COLUMN2% TYPE
col3 TABLE1. COLUMN3% TYPE
);
TYPE t_col_group2 IS RECORD (col4 TABLE1. COLUMN2% TYPE
col5 TABLE1. COLUMN3% TYPE
);
TYPE t_coll_collection IS RECORD (col1 TABLE1. % TYPE COLUMN1
col_group1 t_col_group1
col_group2 t_col_group2
col6 TABLE1. % TYPE COLUMN1
);
TYPE t_table IS the TABLE OF t_coll_collection INDEX DIRECTORY.
v_table t_table;
CURSOR c_table IS
SELECT COLUMN1, COLUMN2, COLUMN3, COLUMN4, COLUMN 5, COLUMN6
FROM TABLE1;
BEGIN
OPEN c_table.
Get the c_table COLLECT in BULK IN v_table;
CLOSE C_table;
END;
I can ' manage to get the data in the table with the COLLECTION in BULK:
Fehlerbericht:
ORA-06550: Line 25, column 35:
PLS-00597: expression "V_TABLE" in the list IS of the wrong type
ORA-06550: Line 25, column 3:
PL/SQL: SQL statement ignored
06550 00000 - "line %s, column % s:\n%s".
* Cause: Usually a PL/SQL compilation error.
* Action:
Thank you!
André
My environment:
Oracle Database 11 g Release 11.2.0.3.0 - 64 bit Production PL/SQL Release 11.2.0.3.0 - Production CORE Production 11.2.0.3.0 AMT for Linux: Version 11.2.0.3.0 - Production NLSRTL Version 11.2.0.3.0 - Production
You must define the SQL type
create or replace type t_col_group1 as an object (col2, col3 number number)
/
create or replace type t_col_group2 as an object (col4 number, number col5)
/
create or replace type t_coll_collection as an object
(
number of col1
col_group1 t_col_group1
col_group2 t_col_group2
number col6
)
/
create or replace type t_table as the t_coll_collection table
/declare
v_table t_table;cursor c_table
is
Select t_coll_collection
(
Column1
t_col_group1 (column2, column3)
t_col_group2 (column4, column5)
column6
)
FROM table1;
Start
Open c_table;
collect the fetch c_table in bulk in v_table;
close c_table;
end;
/
Maybe you are looking for
-
ITunes on my mac does not recognize iphone is
Just got the new iphone is. ITunes on mac doesn't recognize and much my songs are grayed out
-
Updated satellite C75 - A - 15 p and Win10
I had to upgrade to win 10?On the pilot, it will be ok?
-
I have a Split 13 x 2 m110dx PC with processor i3 and I wonder if it can be upgraded to a map of the System i5 and if it would increase the speed/performance enough to be worth the effort. I found the part of Intel to 295.00, which is almost as much
-
Convert Cox Webmail Outlook Express
How can I convert current Cox Webmail for Outlook Express for e-mail? Please answer in plain English and in easy to follow terms
-
Impossible to uninstall all the programs
Whenever I try to uninstall a program using programs uninstall in Control Panel I get the same message "Please wait until that the current program is finished uninstalling or changing" it does not matter what program I select. This message never goes