Find highest date from table
Hi all!
In the two tables (master and user), I want to find the casenum and the name of the user with date of highest routing (r_date).
for example, "PHHY2009PV1001", username "Kerry" should come. I use below approach but his does not work.
Can someone help me
with master as
(
Select 'PHHY2009PV1001' AS CASE_NUM, 1001 AS user_id, 'Japan' under the name of countries, 10 May 1999 ' as r_date from dual union
Select 'PHHY2009PV1001', 1002, "Korea", 10 September 1999 ' double Union
' Select 'PHHY2009PV1001', 1003, "Japan", may 10, 2005 "double Union
Select 'PHHY2009PV1001', 1004, "Japan", 10 August 2006 ' double Union
Select 'PHHY2009PV1007', 1005, 'WE', may 10, 2001 ' Union double
Select "PHHY2009PV1007", 1006, 'USA', 10 June 2002 ' double Union
Select "PHHY2009PV1002", 1007, "Ireland", 10 November 2003 the double Union
Select 'PHHY2009PV1002', 1009, "Ireland", July 10, 2003 "Union double".
Select 'PHHY2009PV1009', 1011, 'Pakistan', November 15, 2004 "double union
Select 'PHHY2009PV1009', 1012, 'Pakistan', December 15, 2004 "Union double".
Select 'PHHY2009PV1009', 1013, 'Pakistan', September 15, 2004 "of the double
),
users
(select 1001 AS user_id, 'John Abraham' as username of union double
Select 1002, "Andréanne' Union double
Select 1003, "Jawahar" Union double
Select 1004, 'Kerry' Union double
Select 1005, 'Kofi' Union double
Select 1006, "Kofi1" Union double
Select 1007, "Kofi2" Union double
Select 1008, 'Kofi3' from dual
)
Select ms.case_num, u.username, ms.r_date
Of
(select case_num, max (r_date) as r_date, user_id of main group case_num, user_id) ms, user u
where ms.user_id = u.user_id
order by 1
The first thing that came to my notice - they are not DATEs, but strings.
Something like that?
with master as
(
Select 'PHHY2009PV1001' AS CASE_NUM, 1001 AS user_id, 'Japan' under the name of countries, 10 May 1999 ' as r_date from dual union
Select 'PHHY2009PV1001', 1002, "Korea", 10 September 1999 ' double Union
' Select 'PHHY2009PV1001', 1003, "Japan", may 10, 2005 "double Union
Select 'PHHY2009PV1001', 1004, "Japan", 10 August 2006 ' double Union
Select 'PHHY2009PV1007', 1005, 'WE', may 10, 2001 ' Union double
Select "PHHY2009PV1007", 1006, 'USA', 10 June 2002 ' double Union
Select "PHHY2009PV1002", 1007, "Ireland", 10 November 2003 the double Union
Select 'PHHY2009PV1002', 1009, "Ireland", July 10, 2003 "Union double".
Select 'PHHY2009PV1009', 1011, 'Pakistan', November 15, 2004 "double union
Select 'PHHY2009PV1009', 1012, 'Pakistan', December 15, 2004 "Union double".
Select 'PHHY2009PV1009', 1013, 'Pakistan', September 15, 2004 "of the double
),
users)
Select 1001 AS user_id, 'John Abraham' as username of union double
Select 1002, "Andréanne' Union double
Select 1003, "Jawahar" Union double
Select 1004, 'Kerry' Union double
Select 1005, 'Kofi' Union double
Select 1006, "Kofi1" Union double
Select 1007, "Kofi2" Union double
Select 1008, 'Kofi3' from dual
)
----
SELECT x.case_num, us.username
DE)
SELECT case_num, user_id (FROM)
SELECT case_num, user_id, RANK() over (PARTITION BY case_num ORDER BY TO_DATE(r_date,'dd/mm/yyyy') DESC) rnk
THE MASTER
) ms WHERE rnk = 1
) x LEFT users JOIN us
WE (x.user_id = us.user_id);
Output-
USERNAME CASE_NUM
Kerry PHHY2009PV1001
PHHY2009PV1007 Kofi1
PHHY2009PV1002 Kofi2
PHHY2009PV1009
-Nordine
Tags: Database
Similar Questions
-
How to recover data from table
I'm new to APEX 4.0, how to recover data from table
My table is CR_USERPROFILE... and I want to recover data to the following recommendations:
Select the title, user name, address, email, mobile, cr_userprofile where e-mail is APEX_CUSTOM_AUTH. GET_USERNAME
Text P110_EMAIL 10 field
20 P110_TITLE selection list
P110_USERNAME 30 text field
Text field P110_ADDRESS 40
P110_PHONE 50 text field
Text P110_MOBILE 60 field
could any body if you please help...
Thanks and greetings
LukeHello
1. create the process Page.
2. Select the Data Manipulation
3. in the category select "Automated line Fetch".
4 enter the process name, sequence, select "on the load - before the headers" to the point.
5. specify the owner, table, primary key and the key column primary (Item name contains the primary key).
6. create a process.
7. in each element, select "Column of the database" in "the Source Type.Kind regards
Patel Kartik
------------------------------------------------------------------------
http://patelkartik.blogspot.com/
http://Apex.Oracle.com/pls/Apex/f?p=9904351712:1 -
Extracting data from table without refreshment and without using the tab key.
Hi friends,
I have a problem I want to extract data from table without discount in the text field without using the Tab key. When I enter a field value any value then the text corressponding should enter into corressponding textfield without using the Tab key.
for example. When I get back emp_id 101 in a text field then first_name and last_name, address would come in to the text fields corressponding without refresh and use the Tab key.
How can I do that.
Thank you
MauryHi Maury,
I guess it's similar to: retrieving data without refreshing rather than Re: value of a textfield should enter into an another textfield without using the TAB ?
If so, the only change you want to bring on the first is to use the parameter "Onkeyup" instead of "onchange" in the 'HTML Form attributes of the element' element.
Note, however, that the user must move away from the issue at some point (for example, to click on a button), so the onchange will fire anyway.
Andy
-
Script Insert statement to extract data from Table in Oracle 7i
Hi all, I have an old Oracle legacy system that works for more than 15 years. Every now and then, we need to extract data from this table @ ORacle 7i to import to Oracle 10 G.
My thoughts are to create a script to Insert statements in oracle 7 and that, to be deployed to Oracle 10 G.
I found cela scripts in Google and don't know exactly how it works. No explanation on these scripts, would be greatly appreciated. I find that this format can help to produce a set of insert statements in this table to the last table to 10G.
< pre >
-Step 1: create this procedure:
create or replace function ExtractData (v_table_name varchar2) return varchar2 as
Boolean b_found: = false;
v_tempa varchar2 (8000);
v_tempb varchar2 (8000);
v_tempc VARCHAR2 (255);
Start
for tab_rec in (select table_name from user_tables where table_name = upper (v_table_name))
loop
b_found: = true;
v_tempa: =' select ' insert into ' | tab_rec.table_name |' (';
for col_rec in (select * from user_tab_columns)
where
table_name = tab_rec.table_name
order by
column_id)
loop
If col_rec.column_id = 1 then
v_tempa: = v_tempa | " ' || Chr (10) | " ' ;
on the other
v_tempa: = v_tempa |', ". Chr (10) | " ' ;
v_tempb: = v_tempb |', ". Chr (10) | " ' ;
end if;
v_tempa: = v_tempa | col_rec.column_name;
If instr(col_rec.data_type,'CHAR') > 0 then
v_tempc: = "' |' | col_rec.column_name |'| " ' ;
elsif instr (col_rec.data_type, 'DATE') > 0 then
v_tempc: = "' to_date ("'| to_char('|| col_rec.column_name||',''mm/DD/YYYY HH24 '') | ") (', "' dd/mm/yyyy hh24"') "';
on the other
v_tempc: = col_rec.column_name;
end if;
v_tempb: = v_tempb | " ' || Decode('|| col_rec.column_name||',''Null'','||v_tempc||') | " ' ;
end loop;
v_tempa: = v_tempa |') values ('| v_tempb |'); "from ' |" tab_rec.table_name | « ; » ;
end loop;
If not b_found then
v_tempa: ='-Table ' | v_table_name | 'not found ';
on the other
v_tempa: = v_tempa | Chr (10) | "select"-commit; "double;';
end if;
Return v_tempa;
end;
/
display errors
-STEP 2: run the following code to extract the data.
Go head
set pages 0
game of stripes on
fixed lines 2000
the feeding off value
trigger the echo
var retline varchar2 (4000)
coil c:\t1.sql
Select 'set echo off' from dual;
Select 'spool c:\recreatedata.sql' from dual;
Select ' select "-these data was extracted on" | TO_CHAR (sysdate, "mm/dd/yyyy hh24" ") double;' double.
-The following two lines as repeat as many times as the tables that you want to extract
exec: retline: = ExtractData ('dept');
print: retline;
exec: retline: = ExtractData ('emp');
print: retline;
Select 'off spool' from dual;
spool off
@c:\t1
-Step 3: run the updated c:\recreatedata.sql waiting for output to recreate the data.
Source: http://www.idevelopment.info/data/Oracle/DBA_tips/PL_SQL/PLSQL_5.shtml
< / pre >Hello
Well what this script do.
You will pass a table name as input to the function that will return varchar2 (string - insert statement). It will generate 2 t1.sql of sql script that contains the output sequence.Will use the first passed the user_tables scipt to check if the input table name exists and if there is the will reterive user_table_columns column names and generate the following sql script.
Now, this t1.sql will run to generate a final sript formally orders insert that will run you on the target schema (make sure that the table exists).* #t1.sql*
set echo off spool recreatedata.sql select '-- This data was extracted on '||to_char(sysdate,'mm/dd/yyyy hh24:mi') from dual; select 'insert into MY_OBJECT1 ('||chr(10)||'OWNER,'||chr(10)||'TOTAL) values ('||decode(OWNER,Null,'Null',''''||OWNER||'''')||','||chr(10)||''||decode(TOTAL,Null,'Null',TOTAL)||');' from MY_OBJECT1; select '-- commit;' from dual; spool off
Then @t1.sql runs, and the general insert for the infeed table table.
-- This data was extracted on 03/09/2009 23:39 INSERT INTO MY_OBJECT1 (OWNER, TOTAL) VALUES ('MDSYS', 92800); INSERT INTO MY_OBJECT1 (OWNER, TOTAL) VALUES ('TSMSYS', 256); INSERT INTO MY_OBJECT1 (OWNER, TOTAL) VALUES ('DMSYS', 15104); INSERT INTO MY_OBJECT1 (OWNER, TOTAL) VALUES ('TESTME', 128); INSERT INTO MY_OBJECT1 (OWNER, TOTAL) VALUES ('PUBLIC', 2571392); INSERT INTO MY_OBJECT1 (OWNER, TOTAL) VALUES ('OUTLN', 768); INSERT INTO MY_OBJECT1 (OWNER, TOTAL) VALUES ('CTXSYS', 21888); INSERT INTO MY_OBJECT1 (OWNER, TOTAL) VALUES ('OLAPSYS', 78336); INSERT INTO MY_OBJECT1 (OWNER, TOTAL) VALUES ('KLONDIKE', 2432); INSERT INTO MY_OBJECT1 (OWNER, TOTAL) VALUES ('SYSTEM', 51328); INSERT INTO MY_OBJECT1 (OWNER, TOTAL) VALUES ('EXFSYS', 21504); INSERT INTO MY_OBJECT1 (OWNER, TOTAL) VALUES ('DBSNMP', 4096); INSERT INTO MY_OBJECT1 (OWNER, TOTAL) VALUES ('ORDSYS', 216192); INSERT INTO MY_OBJECT1 (OWNER, TOTAL) VALUES ('SYSMAN', 111744); -- commit;
Hope this helps
Concerning -
Extracting data from table.
Hello and happy Friday.
I'm reworking an instrument for an HP 662 X power driver. We have four in the lab and I want to have a panel that writes the channel information and reads what the instrument setting are. I have entries works fine, but I can't extract the data from the VI "read the voltage and current. What I would like is the opposite of "build the Subvi where I can get a table and the elements come they channel to the next available line. I have attached the control program which should give you a better understanding of what I'm trying to accomplish here. Any ideas will be greatly appreciated. The pilot, with that I started is one downloaded from NEITHER!
Thank you
Gary
Also: why the property for the resource node VISA? Use a thread.
Attached is a slight mod showing the use of a cluster instead of individual controls if you want to try it.
-
Save and write data from table to table - easy
Hello
I got this system delivered to me. I'm new to LabView and just save the data from the table "average voltage" (inside the while loop) to do some additional testing of our product.
I will like to do similar to this.
(1) save in excel file.
(2) save only when a button button and save it then 5 ilteration.
(3) save and manipulate the data, so it is displayed in 6 columns (each LED 1) instead of 1 long colum.
I tried different things with structure business T/F, which resolved the buttom-request. But I am in doubt I should use, writing to the file of the measurement or write to us to the worksheet (by using labview 15.0)-delimited according to my offer the best possible?
He also seems to be too much to handle when I try to write in txt file, because it pops up with and error that I do not know how to fix, but it says this:
Error-200279
Possible reasons:
The application is not able to cope with the acquisition of equipment.
Increase in the size of buffer, most frequently the reading of data or by specifying a fixed number of samples to read instead of reading all available samples would correct the problem.
Property: RelativeTo
Corresponding value: current playback Position
Property: Offset
Corresponding value: 0
Task name: analog channel
Thanks in advance
I agree with Taki, but want to make some additional remarks:
- LabVIEW is a data flow language. Think of the "flow" of your data. You talk about "save only when a key is pressed" and a finite set of data. You are collecting before the press the button and everything just do not save?
- Data are collected at some rate, and likely, you don't want to "Miss" data points. This means that you shouldn't do anything in the loop of the Collection that takes a long time. If your recovery rate is low and your treatment is fast, you can have everything in a single loop. Otherwise, to use the technical stream (producer/consumer is a good) to process the data in a single loop in parallel with the collection in a loop independent (and asynchronously).
- How do you write your data? You want to write "on the fly", as it is, or can you wait, collect everything, any format and then write it "all at once"?
- What do you mean by 'save the file in Excel? Do you mean a 'native' Excel file, one with the extension .xls or .xlsx? Do you mean a Comma-Separated Variable (.csv) file this reading peut of Excel (and, indeed, usually registers itself to read, change the icon of the .csv files to "look like" it is really an Excel file)? If the first case, I recommend using the report generation tool. But for the latter, you can also use write delimited spreadsheet, which can be easier to use.
Bob Schor
-
I am using data socket server to send and receive data from my camera (a wave front sensor) on the same computer. The data I received is a variant, and I need to convert the variant type to another type of data that I can use in Labview for the calculation and furthur processing.
Variant of data I've received a lot of attributes, and the attribute that I need is a 2D array. However, I see that the size of my table in Labview, but not numeric values. The indicator shows me
4 attributes:
'Centroid_Pos_X'-> [33 x 41]'Centroid_Pos_Y'-> [33 x 41]
"Centroids_X"-> 15
"Centroids_Y"-> 15These four attribute must all turn around a table, but they are all return me the size of the array...
I tried 'get variant attribute' and also 'variant to data'... but impossible to get the correct data.
can someone give me some advice?
You perform an additional step that is not necessary. As I pointed out, the Get variant attribute function has a value entry default, whereby you can wire a 2D table for your table directly:
-
Loading data from table to file odi.
I need to load the data from the table to file without using the interface in odi. How to do it.
Hello
using tool OdiSqlUnload, it loads the table directly.
I tried the db oracle table to the file without using interfaces. I used with procedures.
to achieve this, must create the procedure in odi. Select the control on the target technology: oditool.
«OdiSqlUnload "-FILE = data procedure.txt D:\TEXT\Test" "-DRIVER = oracle.jdbc.OracleDriver" «-URL=jdbc:oracle:thin:@192.0.0.0:1521:odiuser ' '-USER = odiuser ""-PASS = hpfHiT7Ql0Hd79KUseSWYAVIA ""-FILE_FORMAT = VARIABLE ""-FIELD_SEP =, ""-ROW_SEP = \r\n ""-DATE_FORMAT = YYYY/MM/DD hh: mm: ""-CHARSET_ENCODING = ISO8859_1 "" "-XML_CHARSET_ENCODING = ISO-8859-1"»
Select * from odiuser. DWT_SECTOR.
I think this will help for you.
Thnaks in advance,
A.Kavya.
-
Load the data from table to table index
Hello
We need to load index per table to table data. The code below works fine.
declare query varchar2(200); Type l_emp is TABLE OF emp%rowtype INDEX BY Binary_Integer; rec_1 l_emp; begin query :=' SELECT * FROM emp'; EXECUTE IMMEDIATE query BULK COLLECT INTO rec_1 ; For ALL i in rec_1 .First .. rec_1 .Last Insert Into emp_b values rec_1 (i); end; /
But data from the source table and the target table are dynamic.
Ex:
In code, above table emp (source) and target is emp_b are static.
But for our scenario is dependent on the source table, target would change as below.
If source is emp target is emp_b
If source is emp1 target is emp_b1...
create or replace procedure p(source in varchar2, target in varchar2) as query varchar2(200); source varchar2(200); Type l_emp is TABLE OF emp%rowtype INDEX BY Binary_Integer; rec_1 l_emp; begin query :=' SELECT * FROM ' || source; EXECUTE IMMEDIATE query BULK COLLECT INTO rec_1 ; For ALL i in rec_1 .First .. rec_1 .Last execute immediate 'INSERT INTO ' || target || ' values ' ||rec_1(i); end; /
His throw. How to implement this scenario... Please help with that?
No particular reason to use to COLLECT EVERYTHING & BULK here? Why not ordinary
INSERT INTO target SELECT * FROM source;
However if that's what you need you need a dynamic PLSQL block, which comes with additional side effects (code SQL injection). Dynamic SQL is not here.
Kind regards
-
Read data from table of $ E and insert in the staging table
Hi all
I'm new on ODI. I need your help to understand how to read data from a table ' E$ "and insert in an intermediate table.
Scenario:
The name of two columns, in a flat file, the employee and the employee id must be loaded into a data EMPstore +. A check constraint is added so that the data with the employee names in capital letters only to load in the data store. Check the command is set to the static movement . Right-click on the data store, select control , then check. The lines that have violated the check constraint are kept in E$ _EMP+ table.
Problem:
Problem is I want to read the data in the table E$ _EMP+ and transform in capital letters in the name of the employee and move the corrected data of E$ _EMP+ EMP+. Please advise me on how to automatically manage the 'soft' exceptions in ODI.
Thank youIf I understand, you want to change the columns in the tables of $ E and then load into the target.
Now, if you notice how ODI recycles the error, there is an incremental update to the target using the E table $ after he filled the I$ table.
I think you can do the same thing by creating an interface using the table of $ E as source and implement the business logic in this interface to fill the target.
-
Getting data from tables msql and e-mailing the result
Here is some code that I'm eager to collect data from two tables msql and send by email to a user. (This is to remind the user of their user name and password in a weak security situation - that they have submitted their email address)
I glued some elements of other pages together, hoping it will do what I want.
At present, it fails with the message
"You have an error in your SQL syntax. Check the manual for your version of the MySQL server for the right syntax to use near Test "in line 1", after posting $org as requested (as a test)
I would be grateful if someone can debug this problem, or otherwise advise.
<? php require_once('.. /.. / Connections/tormented3.php');? >
<? PHP
now, the recordset to email a link to the training
$colname_rstSix = "1";
If (isset($_GET['email'])) {}
$colname_rstSix = (get_magic_quotes_gpc())? $_GET ['email']: addslashes($_GET['email']);
}
@mysql_select_db ($database_tormented3, $tormented3);
$query_rstSix = sprintf ("SELECT ck_organisation FROM chk_sixmonth WHERE ck_email = ' %s", $colname_rstSix);
$rstSix = mysql_query ($query_rstSix, $tormented3) or die (mysql_error ());
$row_rstSix = mysql_fetch_assoc ($rstSix);
$totalRows_rstSix = mysql_num_rows ($rstSix);
Recordset to the end
$org = $row_rstSix ["ck_organisation"];
echo $org; temporary test. Yes, it sends a correct text to monitornow recordset to the Organization link to access details
@mysql_select_db ($database_tormented3, $tormented3);
$query_rstPword = sprintf ("SELECT username, passwords password organization FROM WHERE = ' %s", $org);
$rstPword = mysql_query ($query_rstPword, $tormented3) or die (mysql_error ());
$row_rstPword = mysql_fetch_assoc ($rstPword);
$totalRows_rstPword = mysql_num_rows ($rstPword);Start with routine e-mail
$start = "your information to update access the website of the mental health of Torbay.
Your host username";// set up the e-mail header
$username = $row_rstSix ["username"];
$pword = $row_rstSix ["password"];
$message. = '$start $username. Your password is $pword\n please update your entries. « ;
If (mail ($email "Recall information Access",
$message, "in: . ((" [email protected] \r\n")) { }
header ('location:http://www.sample.org.uk "") ;// Redirect to the page if the email has been sent successfully
"exit";
} else {}
$error == ' < style p = "color: red;" > an error has occurred, your email could not be sent. Please try again < /p > ';
}? >
Thank you very much.
I assumed that your first successful query because SELECT... ck_organisation your $org echo printed what you expected.
Isn't the second query SELECT... Organization which is a failure? Have you tried the echo method or die in this query? Or is it the one that displays "the query is empty?
Try changing the following code snippet and we'll see what happens. I've added a couple more conditions where you can send them to the form. I added also oblique (') around the domain names in the second query, just in case any of those are reserved words in MySQL (I don't get them, but they are available in the MySQL online documentation).
mysql_select_db($database_tormented3, $tormented3); $query_rstSix = sprintf("SELECT ck_organisation FROM chk_sixmonth WHERE ck_email = '%s'", $colname_rstSix); $rstSix = mysql_query($query_rstSix, $tormented3) or die(mysql_error()); $totalRows_rstSix = mysql_num_rows($rstSix); if (!$totalRows_rstSix) { // no record exists with email $colname_rstSix // Alert user and let them try again. exit; } $row_rstSix = mysql_fetch_assoc($rstSix); //end recordset $org = $row_rstSix['ck_organisation']; echo $org; //temporary test. Yes, it does send correct text to monitor //now recordset to link organisation to access details // mysql_select_db($database_tormented3, $tormented3); // not needed. Still selected from above $query_rstPword = sprintf("SELECT `organisation`, `username`, `password` FROM `passwords` WHERE `organisation` = '%s'", $org); echo "$query_rstPword
"; $rstPword = mysql_query($query_rstPword, $tormented3) or die(mysql_error()); $totalRows_rstPword = mysql_num_rows($rstPword); if (!$totalRows_rstPword) { // no record in passwords with $org // Decide what you want to do in this situation. // exit; ??? } $row_rstPword = mysql_fetch_assoc($rstPword);--
Mark A. Boyd
Keep-on-Learnine :-) -
Hello, gentlemen.
I have some data in 2 columns in a table, and I would like to draw the first column as the x axis, and the second column as the y-axis. The way I found to do it is that separates the two columns and using him 'XY graph building' express vi, as indicated below. However, I find it unpleasant and ugly. Is there a better way to do it? Ideally, I like to keep the data together, without separation, and I don't want to use a large vi 'express '.
Thanks in advance.
Try this:
Simply decide on the two columns and group them. Make sure the index of wire to the lower of the two to get the columns instead of lines.
Also note that the Index is resizable, so you don't need to a single instance.
(If you want two rows, you need not plug all the clues on board index).
-
Extracting data from table using the date condition
Hello
I have a table structure and data as below.
create table of production
(
IPC VARCHAR2 (200),
PRODUCTIONDATE VARCHAR2 (200),
QUANTITY VARCHAR2 (2000).
PRODUCTIONCODE VARCHAR2 (2000).
MOULDQUANTITY VARCHAR2 (2000));
Insert into production
values ('1111 ', '20121119', ' 1023', 'AAB77',' 0002');
Insert into production
values ('1111 ', '20121122', ' 1023', 'AAB77',' 0002');
Insert into production
values ('1111 ', '20121126', ' 1023', 'AAB77',' 0002');
Insert into production
values ('1111 ', '20121127', ' 1023', 'AAB77',' 0002');
Insert into production
values ('1111 ', '20121128', ' 1023', 'AAB77',' 0002');
Insert into production
values ('1111 ', '20121201', ' 1023', 'AAB77',' 0002');
Insert into production
values ('1111 ', '20121203', ' 1023', 'AAB77',' 0002');
Insert into production
values ('1111 ', '20121203', ' 1023', 'AAB77',' 0002');
Insert into production
values ('1111 ', '20130103', ' 1023', 'AAB77',' 0002');
Insert into production
values ('1111 ', '20130104', ' 1023', 'AAB77',' 0002');
Insert into production
values ('1111 ', '20130105', ' 1023', 'AAB77',' 0002');
Now, here I want to extract the data with condition as
PRODUCTIONDATE > = the current week Monday
so I would skip only two first rows and will need to get all the lines.
I tried to use it under condition, but it would not give the data for the values of 2013.
TO_NUMBER (to_char (to_date (PRODUCTIONDATE, 'yyyymmdd'), 'IW')) > = to_number (to_char (sysdate, 'IW'))
Any help would be appreciated.
Thank you
MaheshHello
HM wrote:
by the way: it is generally a good idea to store date values in date columns.One of the many reasons why store date information in VARCHAR2 columns (especially VARCHAR2 (200)) is a bad idea, it's that the data invalid get there, causing errors. Avoid the conversion of columns like that at times, if possible:
SELECT * FROM production WHERE productiondate >= TO_CHAR ( TRUNC (SYSDATE, 'IW') , 'YYYYMMDD' ) ;
-
Import data from table in another table via datapump
Hello
I have Oracle 11 GR 2 on Windows 2008 Server R1 64-bit version.
I took a support for the export of table through data pump, the table name is sql_temp , my requirement is to import the data into another table, as sql_temp1 using the data pump even export the backup.
Is is possible? How can we achieve this through data pump?
Thank you and best regards,
Vikash Jain (Junior DBA)Not really a big problem:
C:\Windows\system32>expdp scott/tiger tables=emp directory=DATA_PUMP_DIR dumpfile=test.dmp logfile=log.log Export: Release 11.2.0.1.0 - Production on Thu Apr 26 11:49:18 2012 Copyright (c) 1982, 2009, Oracle and/or its affiliates. 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 Starting "SCOTT"."SYS_EXPORT_TABLE_01": scott/******** tables=emp directory=DATA_PUMP_DIR dumpfile=test.dmp logfile=log.log Estimate in progress using BLOCKS method... Processing object type TABLE_EXPORT/TABLE/TABLE_DATA Total estimation using BLOCKS method: 64 KB Processing object type TABLE_EXPORT/TABLE/TABLE Processing object type TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS . . exported "SCOTT"."EMP" 8.570 KB 14 rows Master table "SCOTT"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded ****************************************************************************** Dump file set for SCOTT.SYS_EXPORT_TABLE_01 is: E:\APP\SERVERROOM\ADMIN\ORCL\DPDUMP\TEST.DMP Job "SCOTT"."SYS_EXPORT_TABLE_01" successfully completed at 11:49:32 C:\Windows\system32>impdp scott/tiger tables=emp directory=DATA_PUMP_DIR dumpfile=test.dmp logfile=log.log remap_table=emp:testemp Import: Release 11.2.0.1.0 - Production on Thu Apr 26 11:50:10 2012 Copyright (c) 1982, 2009, Oracle and/or its affiliates. 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 Master table "SCOTT"."SYS_IMPORT_TABLE_01" successfully loaded/unloaded Starting "SCOTT"."SYS_IMPORT_TABLE_01": scott/******** tables=emp directory=DATA_PUMP_DIR dumpfile=test.dmp logfile=log.log remap_table=emp:testemp Processing object type TABLE_EXPORT/TABLE/TABLE Processing object type TABLE_EXPORT/TABLE/TABLE_DATA . . imported "SCOTT"."TESTEMP" 8.570 KB 14 rows Processing object type TABLE_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX ORA-31684: Object type INDEX:"SCOTT"."PK_EMP" already exists Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT ORA-31684: Object type CONSTRAINT:"SCOTT"."PK_EMP" already exists Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS ORA-39111: Dependent object type INDEX_STATISTICS skipped, base object type INDEX:"SCOTT"."PK_EMP" already exists Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT ORA-31684: Object type REF_CONSTRAINT:"SCOTT"."FK_DEPTNO" already exists Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS Job "SCOTT"."SYS_IMPORT_TABLE_01" completed with 4 error(s) at 11:50:13 C:\Windows\system32>sqlplus scott/tiger SQL*Plus: Release 11.2.0.1.0 Production on Thu Apr 26 11:50:31 2012 Copyright (c) 1982, 2010, 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 SQL> select count(*) from testemp; COUNT(*) ---------- 14 SQL>
Concerning
Girish Sharma -
Help! Transfer data from Table to another!
Hello
my case is: I have a 2 tables, the first contains personal information of an employee, and I have a form that displays employee data.
so I want when I submit the form, the data moves from the entire table to another table, then how do I do that?
* I use Dreamweaver CS5!
INSERT INTO table1 (fld1, fld2, etc) SELECT fld1, fld2, etc FROM table2 WHERE.....;
Question: Why do you have 2 similar tables and why you duplicate data? Is it not enough to store the primary key of the table 2 in table1?
Maybe you are looking for
-
Some e-mail comes to the iPhone but not for Mac
Recently some, but not all, mailed to one of my two email accounts (not account "me.com" but my local ISP) happens on my iPhone but not on my Mac (both devices to the newest OS Help). I see nothing in the settings, system preferences or any other whi
-
I put a password on my thunderbird e-mail program
I have a shared computer, and I would like to put a password on my email isn't public. How can I do this?
-
Airport express at slow speed of the modem Arris SB6190
Hello! My so-called WIFi Comcast gives me 150Mbps. My test only show 70 or slower speed on a WiFi test. After the call to them they told me to talk to my modems customer service. But their customer service is terrible. Here is my setup and yes everyt
-
Re: Portege M300: Wifi card which is installed
Hello, I rebooted my Portege M300 and I went to the page of the drivers for the m300.But it gives you an ateros... However you spell pilot... But I'm sure it was a processor intel before I reloded he... Pls look at the download page and it says the t
-
Satellite L30-134 will not accept 2 GB of RAM
I looked at my laptop and it takes a maximum of 2 GB of DDR2 RAM, I tried two different pairs of sticks of 1 GB and the two blue screen that loads the OS. When the sticks do not go it simply ignores the second run, but I can't seem to accept 2 GB. BT