SQLLDR, get the incorrect records
Hi forum,I followed records from a CSV file. I need to extract a table. But I'm getting incorrect records.
check-in:
9, 107CV6, 2079-06-06 00:00:00.000, 2079-01-01 00:00:00.000
CTL file:
load data
INFILE 'file1.csv.
BadFile "ifile1.bad."
Truncate in table tab1
fields ended by ',' optionally surrounded "" "
trailing nullcols
(
col1,
col2,
col3,
COL4
)
Table:
CREATE TABLE tab1 (col1 VARCHAR (100), col2 VARCHAR (100), col3 VARCHAR (100), col4 VARCHAR (100));
columns 3 and 4 seems to be the origin of the problem because it contains-,:, and. characters
Thank you
Mahesh
Tags: Database
Similar Questions
-
What is the best way to get the last record in a table?
... in addition to select * from tbl by id Desc... & then set = 1 maxrow in cfoutput.
I want a quick way.
I tried "Max (id), columns, but not worked.
If I ' Max (id) as V ' & then turn around and make another request for ' where id = #V # "to get the rest of the record, there's more action.
Quote:
Posted by: paross1
One way...SELECT all your columns
From your_table
WHERE your_engagement_appid = (SELECT MAX (your_id)
From your_table)Phil
Thank you guys. It worked great.
I also tried the front joined query where the... I would have thought that.
Thank you! -
can not restore again peripheral iPhone, get the incorrect password
I just upgraded the iPhone 5 s 6 s. Run backup on my MacBook first. every tie I try to restore it, I get an incorrect password error.
Which version of iOS was running on your 5 s? Also, on which device is the message "incorrect password" that appear? If your 5s was running an older version of iOS, you may not be able to restore on your 6s. If you still have children 5 years old and he is not on the latest version of the software, (iOS 9.2), then make sure that you have on that and do a backup then. If this is the problem, then you should have your 6s facing up and running without delay.
-
How to get the different records for the date max.
Hi all
Here is the sample sql for sample table and data.
Create table student (dept_id number(10), first_name varchar2(10),last_name varchar2(10),join_date date,years_attended number(10));
insert into student values (1,'Ann','Coleman',to_date('3/7/1917','MM/DD/YYYY'),4);
insert into student values (1,'Ann','Coleman',to_date('3/7/1916','MM/DD/YYYY'),5);
insert into student values (2,'Rock','Star',to_date('1/1/1920','MM/DD/YYYY'),5);
insert into student values (2,'Rock','Star',to_date('1/1/1921','MM/DD/YYYY'),6);
insert into student values (3,'Jack','Smith',to_date('7/1/1900','MM/DD/YYYY'),3);insert into student values (3,'Jack','Smith',to_date('7/1/1901','MM/DD/YYYY'),4);
commit;
I need to get maximum date records when the name and dep_id corresponds to. I wrote the query below and it becomes the expected result, but I'm not sure it's quite effective.
SELECT s.dept_id, s.first_name,s.years_attended
FROM (SELECT dept, MAX (join_date) join_date
STUDENT GROUP BY dept_id) x
Student JOIN s ON x.dept_id = s.dept_id AND x.join_date = s.join_date;
This above query returns records like below, and this is the goal.
DEPT_ID NAME YEARS_ATTENDED
1 Ann 4
2 Rock 6
3 Jack 4
Can you please let me know the query SQL I wrote is effective or not? This sample table may have less data, but I'm dealing with millions of records.
Hello
Thanks for posting CREATE TABLE and INSERT statement. This really helps.
Here's a solution. I also added a name that seems logical. In which case you can delete:
Select dept_id, first_name, last_name
, max (years_attended) Dungeon years_attended (last dense_rank order by join_date)
the student
Group of dept_id, first_name, last_name;
DEPT_ID FIRST_NAME LAST_NAME YEARS_ATTENDED
---------- ---------- ---------- --------------
1 Ann Coleman 4
Rock 2 star 6
3 Jack Smith 4
Kind regards.
Alberto
-
For each hit in the where clause, also get the entourage records
We have a table that contains the content of some files. The structure of the table is (Simplified):
CREATE TABLE LOG_LINES
(
FILE_ID NUMBER (15.0).
LOG_LINE_NUMBER NUMBER (9.0).
CLOB LOG_LINE
)
We build a search engine that looks through the lines to find a regular expression, it should return the lines that match the regular expression, in addition to 5 lines before this line and 5 rows after this line.
So to say that our regex match line 10, we must return the row 5 to 15.
Currently, this is how we solve our problem:
1 questioning the rows that match the regular expression (select file_id, log_line_number from log_lines where regexp_like (log_line, 'Search'))
2. for each record that is returned by this query: query the table log_lines to get the required rows (select * from log_lines where file_id = x and log_line_number between y and z)
Now, it seems to create a lot of overhead, because there could be 1000 matches, it takes to 1000 queries for all results.
I was wondering if there is a better way to tackle this problem. It may be possible to just 1 request that returns the corresponding lines more than 5 records before and after.
Any help on this would be greatly appreciated!
Published by: Peter Marcoen on 11 January 2013 04:22
Published by: Peter Marcoen on 11 January 2013 04:23with t as ( select file_id, log_line_number from log_lines where regexp_like(log_line,'search') ) select file_id, log_line_number from log_lines l, t where l.file_id = t.file_id and l.log_line_number between t.log_line_number - 5 and t.log_line_number + 5 /
SY.
-
get the current record in the rich table
Hello
I have a rich table in my program
user can select a table row and update it in the form of popup
I use the command rollback in popup
If the user select rollback selected line in table display to the first record
I want that the restore does not affect in the selected row in the table
I don't know how I can get the index of the row selected in the table before you restore and update table after cancellationTry the section
How-to - keep selected line after cancellation
in this link:
http://www.Oracle.com/technetwork/developer-tools/ADF/learnmore/OCT2010-OTN-harvest-183714.PDF -
How to get the particular record last
Hello
I want the query because if a particular record available when enter as a last record.
Ex,
name
----------
s
t
h
but t is always the last record. How to get?
Thank you
Alphadi.Welcome to the forum.
Do you mean you want to 'h' to appear as the last record?
Try:SQL> -- generating sample data: SQL> with t as ( 2 select 'h' name from dual union 3 select 's' from dual union 4 select 't' from dual 5 ) 6 -- 7 -- actual query: 8 -- 9 select name 10 from t 11 order by case 12 when name = 'h' then 2 13 else 1 14 end; NAME -------------------- s t h 3 rows selected.
-
How to get the current record in a block?
Hello
How can I get the registration of a block, but the current record of the records displayed by this block? (for example if the number of records is 50, but the number of displayed records is 10, I want to get the current_record from the 10, not all 50).
the: system.current_record returns the current all-time record
Thank youYou can use a combination of: SYSTEM. CURSOR_RECORD which returns the current record and GET_BLOCK_PROPERTY ('BLOCK', TOP_RECORD), which returns the number of the record that is displayed as the first visible record, your result should be something like
:SYSTEM.CURSOR_RECORD-GET_BLOCK_PROPERTY('BLOCK', TOP_RECORD)+1;
-
Is there an easy way to get the previous record in the Apex?
I'm new to APEX/Oracle, but have a lot of expierence as a mainframe programmer and some experience with SQL.
I have been instructed by my boss to create a set of pages in an application like this.
Page 1: Select an employee name and go to Page 2.
Page 2: View employee biography information.
Add a 'Next employee' button and a button "Previous employee" who picks the previous employees respectively biography info.
Essentially, he wants a query with information biography of each employee with an employee selected on page 1, used as pointer to start.
I built successfully "select the name of an employee on page 1" and "show its info on page 2" with a query that returns a single record.
What I can not know is how to get a next and previous button for the next or previous record in a record multi query, using the initially selected employee as intial pointer.
Is their an easy way to build this using functionailty of integrated APEX, or will it require programming to reach this requirement?Just realized that I didn't fully answer your question. According to the number of employees, you can create a collection to contain all the information and who travels with buttons. Or you could include a calculation to transmit the current employee, previous and next to your second page using the standard apex_application.gf01... GFN see the creation process to get the id of current line
Keep smiling,
Bob R -
SQL query to get the NULL records after the last matching flag
I have a xx1 table with id and flag columns. So I want the data in this table, after the last flag matched. I want that data to id 7 in the rooms. Even if the id 2,3,5 are null flag 'Y' was at 6. ID so I need a query to get the data of the xx1 table after the last correspondence flag (from 7 to 9 id).
SQL > create table xx1
2 (identification number,
3 flag varchar2 (10));
Table created.
SQL > insert into xx1 values (1, 'Y');
1 line of creation.
SQL > insert into values xx1 (2, null);
1 line of creation.
SQL > insert into values xx1 (3, null);
1 line of creation.
SQL > insert into xx1 values (4, 'Y');
1 line of creation.
SQL > insert into values xx1 (5, null);
1 line of creation.
SQL > insert into xx1 values (6, 'Y');
1 line of creation.
SQL > insert into values xx1 (7, null);
1 line of creation.
SQL > insert into values xx1 (8, null);
1 line of creation.
SQL > insert into values xx1 (9, null);
1 line of creation.
SQL > select * from xx1.
FLAG OF THE ID
---------- ----------
1. IS
2
3
4. IS
5
6. IS
7
8
9
9 selected lines.
SQL >
Hello
user11164339 wrote:
Hi Frank - when I run the query, I don't see the results data.
I get
FLAG OF THE ID
----- ----------
7
8
9
What you do differently?
-
How to get the last records of a Table
Hey Geeks,
I have this 'conflict '.
I need to get the 'current balance' for each account, the newest "current_Balance".
The table looks like this
ACCOUNT_ID BUSINESS_TRANSACTION_ID CURRENT_BALANCE TRANSACTION_AMOUNT TRANSACTION_DATE 1 062 570 238 043 517 51'022 -20'000 31.03.2014 17:49:00.808000 1 062 570 238 042 407 71'022 -20'000 31.03.2014 17:33:55.666000 1 062 570 238 042 368 91'022 -26'000 31.03.2014 17:33:20.067000 1 062 570 238 041 273 117'022 -50,000 31.03.2014 17:18:25.189000 1 062 570 238 041 174 167'022 -10,000 31.03.2014 17:16:59.361000 1 062 570 238 038 702 177'022 -2'500 31.03.2014 16:44:58.332000 5 607 555 238 046 713 1'026 -28'500 31.03.2014 18:35:16.212000 5 607 555 238 040 592 29'526 -100,000 31.03.2014 17:10:15.474000 I need this result:
ACCOUNT_ID CURRENT_BALANCE
5 607 555 1'026
1 062 570 51'022
How we handle this?
Thxs for your help
Ineffective :-)
SELECT Account_id
MAX (current_balance) KEEP (DENSE_RANK LAST ORDER BY transaction_date) current_balance
MAX (business_transaction_id) KEEP (DENSE_RANK LAST ORDER BY transaction_date) business_transaction_id
Of account_balances
GROUP BY account_id
Concerning
Marcus
-
Hello people,
I currently have a working for this using PL/SQL solution, but it would be nice to have it using SQL. Any help is appreciated and once again, to your practice time.
I'm looking to pick up the most recent date and the corresponding user that updated registration for a student in particular. There are two tables T1 and T2. The most recent date can be the create_date or modified_date of T1 or T2.
Scripts for creating the table and INSERT statements:
create table T1 ( code varchar2(4), create_date date, create_userid varchar2(20), modified_date date, modify_userid varchar2(20)); create table T2 ( code varchar2(4), visit_id number, visit_date date, create_date date, create_userid varchar2(20), modified_date date, modify_userid varchar2(20));
insert into T1 values ('1001',to_date('06-FEB-2013 09:12:12','DD-MON-YYYY HH24:Mi:SS'),'ROGER',to_date('12-APR-2013 13:01:12','DD-MON-YYYY HH24:Mi:SS'),'BRIAN'); insert into T2 values ('1001',1,to_date('10-JAN-2013','DD-MON-YYYY'), to_date('10-JAN-2013 14:12:12','DD-MON-YYYY HH24:Mi:SS'),'ROGER',to_date('12-MAR-2013 12:01:06','DD-MON-YYYY HH24:Mi:SS'),'AMY'); insert into T2 values ('1001',2,to_date('31-JAN-2013','DD-MON-YYYY'), to_date('12-MAY-2013 16:11:12','DD-MON-YYYY HH24:Mi:SS'),'GRACIE',null,null); insert into T1 values ('1002',to_date('12-JAN-2013 11:12:13','DD-MON-YYYY HH24:Mi:SS'),'LYNNELLE',to_date('12-APR-2013 13:01:12','DD-MON-YYYY HH24:Mi:SS'),'BRIAN'); insert into T2 values ('1002',1,to_date('10-JAN-2012','DD-MON-YYYY'), to_date('10-JAN-2012 09:12:12','DD-MON-YYYY HH24:Mi:SS'),'ROGER',to_date('12-APR-2013 13:04:12','DD-MON-YYYY HH24:Mi:SS'),'AMY'); insert into T2 values ('1002',2,to_date('10-JAN-2013','DD-MON-YYYY'), to_date('12-JAN-2013 11:12:13','DD-MON-YYYY HH24:Mi:SS'),'JOHN',null,null); insert into T1 values ('1003', to_date('04-FEB-2014 12:01:01', 'DD-MON-YYYY HH24:Mi:SS'), 'LYNNELLE', null, null);
I want to show for the three codes are the following records:
Code Table Date User ID 1001 T2 12-MAY-2013 16:11:12 GRACIE 1002 T2 12-APR-2013 13:04:12 AMY 1003 T1 04-FEB-2014 12:01:01 LYNNELLE
1001 students, the most recent is the create_date of the visit count = 2 for the Code 1002, the most recent date comes from modified_date for visit 1 (its 3 seconds later than the T1 modified_date). Finally, for students 1003 (who did not all records in T2, the create_date is the only date and must be picked up.
Thanks in advance.
with t as)
Select the code,
NVL (MODIFIED_DATE, create_date) dt.
case nvl (modified_date, create_date)
When modified_date then modify_userid
of other create_userid
end userid,
Tbl "T1".
from t1
Union of all the
Select the code,
NVL (MODIFIED_DATE, create_date) dt.
case nvl (modified_date, create_date)
When modified_date then modify_userid
of other create_userid
end userid,
Tbl 'T2 '.
the t2
)
Select the code,
Max (TBL) keep (dense_rank last order by dt, tbl) tbl.
Max (DT) dt,
Max (UserID) keep (dense_rank last order by dt, tbl) userid
t
Code group
order by code
/
CODE TO DT USERID
---- -- -------------------- --------------------
1001 T2 MAY 12, 2013 16:11:12 GRACIE
1002 T2 12 APRIL 2013 13:04:12 AMY
1003 T1 4 FEBRUARY 2014 12:01:01 MANONSQL >
SY.
-
How to get the previous record that meets a criterion?
Hello!
I am trying to create a query that adds information which finally fixed an element for a given 'pause'.
I have a table, let's call it actionHistory, which looks like:
ID | timestamp | action | author
------------------------------------------------
101477 | 2010-05-10 09:10:20 | Difficulty | Tim
101477 | 2010-05-10 09:10:30 | change | John
101477 | 2010-05-10 09:10:40 | breaking | Maggie
101477 | 2010-05-10 09:10:50 | Difficulty | Rick
222222 | 2010-05-10 09:10:30 | change | Lewis
222222 | 2010-05-11 09:10:40 | breaking | Maggie
222222 | 2010-05-11 09:10:50 | Difficulty | Tim
222222 | 2010-05-12 09:10:40 | Difficulty | Maggie
222222 | 2010-05-13 09:10:40 | breaking | Albert
I'm looking for is the following result:
ID | timestamp | action | author | lastFixBy
-----------------------------------------------------------
101477 | 2010-05-10 09:10:20 | Difficulty | Tim |
101477 | 2010-05-10 09:10:30 | change | John |
101477 | 2010-05-10 09:10:40 | breaking | Maggie | Tim
101477 | 2010-05-10 09:10:50 | Difficulty | Rick |
222222 | 2010-05-10 09:10:30 | change | Lewis |
222222 | 2010-05-11 09:10:40 | breaking | Maggie |
222222 | 2010-05-11 09:10:50 | Difficulty | Tim |
222222 | 2010-05-12 09:10:40 | Difficulty | Maggie |
222222 | 2010-05-13 09:10:40 | breaking | Albert | Maggie
Can you tell me how I can make?
I tried many ways but no return to what I'm looking for.
Thanks in advance.
Published by: user8910765 on June 5, 2010 13:51
Published by: user8910765 on June 5, 2010 14:00Hello
That's what you asked for in Oracle 10:
SELECT a.* , CASE WHEN action = 'break' THEN LAST_VALUE ( CASE WHEN action = 'fix' THEN author END IGNORE NULLS ) OVER ( PARTITION BY id ORDER BY tmstmp ) END AS lastfixby FROM actionhistory a ORDER BY id , tmstmp ;
Like all of the built-in functions, LAST_VALUE is documented in the manual of the SQL language:
http://download.Oracle.com/docs/CD/B19306_01/server.102/b14200/functions073.htm#sthref1508user8910765 wrote:
... just in case where it might be useful, one of the queries I've tried myself a left subquery joined that Oracle has no right ("a column may be outside not attached to a subquery').Much more, it would help if you posted the request.
It looks like you were using the old outer join notation (+). You can get the desired results by using an outer join with ANSI rating, but I think it would be more complicated and slower than with a LAST_VALUE. -
get the only recording where the sum is less
Hello
I need to find all the empno all together (sum) is equal in early 2000 by lowest SALselect EMPNO, SAL from EMP 7369 800 7499 1600 7521 1250 7566 2975 7654 1250 7698 2850 7782 2450 7788 3000 7839 5000 7844 1500 7876 1100 7900 950 7902 3000 7934 1300
IF the sum is below 2000, I can then take an empno, also if, then, the sum will be longer than 2000
It's
800 +.
950 + = 1750
1100 +.
= 2850
I can get the first empno 3 discs = (7369,7900,7876)
If I want to compare with 1750 instead of 2000, I get only two first empno = (7369,7900)
How can he do?
Thanks in advanceSQL> select empno, sal 2 from ( 3 select empno, sal, sal1, nvl(lag(sal1) over(order by sal),0) lsal 4 from (select EMPNO, SAL, sum(sal) over(order by sal) sal1 from EMP)) 5 where lsal <2000 6 / EMPNO SAL ---------- ---------- 7369 800 7900 950 7876 1100 SQL> select empno, sal 2 from ( 3 select empno, sal, sal1, nvl(lag(sal1) over(order by sal),0) lsal 4 from (select EMPNO, SAL, sum(sal) over(order by sal) sal1 from EMP)) 5 where lsal <1750 6 / EMPNO SAL ---------- ---------- 7369 800 7900 950
-
What you find works best to get the webinar recorded?
Hi all
New to this forum and Eloqua. About to create my first campaign around a webinar and just wanted to hear some thoughts on the webinars.
(1) do you find creating a webinar series or individual Webinars is best to get people to register for these events? I'm new on my role and my former company, we organized the different series with positive results but in my new business, it seems that each webinar is on a new topic, without brand.
(2) what do you find is a good webinar invitation? How many times should you put register now? You make ball a list of what the registrant will be able to remove this event? Is it a good idea to have two columns? Any idea is appreciated!
(3) are there post-event survey questions you will find are indicators of great lead?
(4) what are some interesting tactics that you used to generate additional leads from webinars? For example, I tried to put a matter of voting, in an email reminder and based on their answer, he took them to a different landing page. Other neat ideas?
I hope to learn a lot from this community! Impatient for there
My theory is that if a person didn't open or click on your first two invitations, then they are not interested. However, if they did open or click either of the initial prompt, but for some reason any, that they are not, I tell myself that it is low hanging fruit. We used a different approach with this email last attempt the first two invitations - it was a text e-mail sent by a person. We have seen a slight increase in the records. Sounds like it could be a good test!
Maybe you are looking for
-
33 Firefox extension for all users
How can I make an extension available for all users using Firefox 33?I have the as and extract if necessary?
-
Connection problem App Store in a specific device
Hi guys,. as of today, I have a problem with the App Store on my iMac. I can not connect, but I don't have the same problem with my MacBook Air. Even if I connected without problems in iTunes on my iMac. App Store does not recognize my credentials an
-
forget my email of rescue of security issues is pending
Hello I forgot my security questions in Apple, ID and my email to rescue is WAITING, I tried several times but received no e-mail, Help, please. Apple ID: [email protected] Thank you.
-
HP Pavilion dm4-1165dx Entertainment Notebook PC DVD Drive replacement
I am repairing a laptop, that I got at a yard sale that did not have a DVD player with it. I would like to buy a replacement for this drive but can't seem to find anywhere here to do. A google search came with a few different than those looking to se
-
Behaviors of icon on the notification bar is grayed out
Original title: the default icons appears not Default icons (for example, the speaker icon) are not on the taskbar and the arrow is missing with a lot of different icons. When I try and enable them with "Show or hide the Volume (speaker) icon on the