How to have a common value for a column using sql loader
Hi Have a sql loader file which looks like below. But I am not getting how insert the same value for the column in all rows.
id,
crt_user_id
BEGINDATA
1;"system"
2;"system"
3;"system"
So, instead of entering the crt_user_id as system in all rows, can we place the value at the top after the column name?
Thanks Srini. your hint/suggestion helped me in finding the solution.
LOAD DATA
INFILE *
BADFILE './TEST.BAD'
DISCARDFILE './TEST.DSC'
APPEND INTO TABLE TEST_TABLE
Fields terminated by ";" Optionally enclosed by '"'
ID,
crt_user_id CONSTANT 'SOME CONSTANT VALUE'
BEGINDATA
1
2
3
so by using CONSTANT key word, we can avoid tying the same value in the data
Similar Messages
-
From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?
Hi,
Use NVL or COALESCE:
NVL (col_a, col_b)
Returns col_a if col_a is not NULL; otherwise, it returns col_b.
Col_a and col_b must have similar (if not identical) datatypes; for example, if col_a is a DATE, then col_b can be another DATE or it can be a TIMESTAMP, but it can't be a VARCHAR2.
For more about NVL and COALESCE, see the SQL Language manual: http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions119.htm#sthref1310
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
See the forum FAQ: https://forums.oracle.com/message/9362002 -
How to find out the script for the table using SQL
Hi,
Could any one tell me that how to find out the script for the table using SQL.
Thanks,
kamalKamal,
You can find the SQL query in Advanced tab of Answers
Thanks,
Balaa... -
How to have a unique value for each record??
could any 1 help me out in this...
I want to have a column name 'Order No' which should be unique.
How to generate a unique value for each record.??could any 1 help me out in this...
I want to have a column name 'Order No' which should be unique.
How to generate a unique value for each record.?? If you are using SQL PLUS to create the table try something like
this:
CREATE TABLE ORDER_TEST (
ORD_NO NUMBER (8) NOT NULL PRIMARY KEY,
ORDERDATE DATE,
CUSTID NUMBER (8) NOT NULL,
SHIPDATE DATE,
TOTAL NUMBER (8,2) CONSTRAINT TOTAL_ZERO CHECK
(TOTAL >= 0),
CONSTRAINT ORD_FOREIGN_KEY FOREIGN KEY (CUSTID) REFERENCES
CUSTOMER (CUSTID),
CONSTRAINT ORD_UNIQUE UNIQUE (ORD_NO)
-- or a simpler table example
DROP TABLE ORDER_TEST;
CREATE TABLE ORDER_TEST (
ORD_NO NUMBER (8),
ORDERDATE DATE,
CUSTID NUMBER (8) NOT NULL,
SHIPDATE DATE,
TOTAL NUMBER (8,2) CONSTRAINT TOTAL_ZERO CHECK
(TOTAL >= 0),
CONSTRAINT ORD_UNIQUE UNIQUE (ORD_NO)
note: ORD_NO can also be a primary key
If you are doing the INSERT during runtime from a form first
create a sequence in SQL PLUS to handle the ORD_NO value:
Create SEQUENCE ORDERNO_UNIQUEVAL_sqnc
START WITH 000001
NOMAXVALUE
NOCACHE;
and reference it as the ORD_NO parameter in your INSERT
statement:
ORDERNO_UNIQUEVAL_sqnc.NEXTVAL
note: to maintain data integrity you must use the sequence
everytime you insert a new order to table. To start a new
sequence drop the sequence and re-create it with whatever "START
WITH" value you want.
Hope this helps
Kevin -
How to load date column using sql loader
Hi,
I am trying to load a file using sql loader. my date value in the file is '2/24/2009 8:23:05 pm',
In control file for this column i specified like this
rec_date date ''mm/dd/yyyy hh:mi:ss pm"
But i am getting following error
not avalid month.
Thanks
sudheerHi,
Use this example as reference:
CTL file:
LOAD DATA
INFILE 'test.txt'
BADFILE 'test.bad'
truncate INTO TABLE T3
FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '|' TRAILING NULLCOLS
dt_date DATE "mm/dd/yyyy hh:mi:ss pm")DAT file:
2/24/2009 8:23:05 pm
C:\ext_files>sqlldr hr/hr control=test.ctl
SQL*Loader: Release 10.2.0.1.0 - Production on Wed Jul 1 20:35:35 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Commit point reached - logical record count 1
Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
Connected as hr
SQL> desc t3;
Name Type Nullable Default Comments
DT_DATE DATE Y
SQL> select to_char(dt_date, 'mm/dd/yyyy hh24:mi:ss') from t3;
TO_CHAR(DT_DATE,'MM/DD/YYYYHH2
02/24/2009 20:23:05
SQL> Regards,
Edited by: Walter Fernández on Jul 1, 2009 8:35 PM - Adding example...
Edited by: Walter Fernández on Jul 1, 2009 8:38 PM
Edited by: Walter Fernández on Jul 1, 2009 8:41 PM - Fixing some information... -
How to have more than one condition on same column --- using SQL Loader
Hi All,
I am stuck with SQL Loader..
How do I filter records before loading in the table using when clause..
i should load data only when
field1 = 'AC' or 'VC'
field2 is NULL
i used various combinations in when clause like
a) when field1='AC' or field1='VC' and field2 = BLANKS
b) when (field1='AC') and (field2 = BLANKS )
& similar...
In all the cases I tried I could not implement OR condition with field1 and null condition with field2
but my main concern is can we use OR or IS NULL things in when clause of SQL Loader..
is it possible to check this anywhere??
any alternate solution u could suggest??
Thanks
DikshitOk I'll try that, although I did try it earlier when I had iTunes 5.xx loaded, I think.
As to size of playlists, I have a master (900 songs) that defines what will fit onto the ipod , I then generate all the others as subsets of the master (not of the library)- hence I know they will all fit
Can you also clarify something for me: the dialogue box we are discussing is intended, I think, so that one can set the automatic synching of certain playlists between the PC & the ipod. Is that the only way one can select other playlists to go to the ipod - i.e. as static once-offs, not synchronised ?
Apple' docs, I think, are poor in this regard - they assume most ipods are bigger then the users song library and they gloss over the details of this alternate mode of playlist synching.
Thanks - Nick -
Problem in Loading data for clob column using sql ldr
Hi,
I am having problem in loading data for tables having clob column.
Could anyone help me in correcting the below script for ctrl file inorder to load the data which is in mentioned format.
Any help really appreciated.
Table Script
Create table samp
no number,
col1 clob,
col2 clob
Ctrl File
options (skip =1)
load data
infile 'c:\1.csv'
Replace into table samp
fields terminated by ","
trailing nullcols
no,
col1 Char(100000000) ,
col2 Char(100000000) enclosed by '"' and '"'
Data File(1.csv)
1,asdf,"assasadsdsdsd""sfasdfadf""sdsdsa,ssfsf"
2,sfjass,"dksadk,kd,ss""dfdfjkdjfdk""sasfjaslaljs"
Error Encountered
ORA-01461: can bind a LONG value only for insert into a LONG column
Table sampThanks in advanceI can't reproduce it on my 10.2.0.4.0. CTL file:
load data
INFILE *
Replace into table samp
fields terminated by ","
trailing nullcols
no,
col1 Char(100000000) ,
col2 Char(100000000) enclosed by '"' and '"'
BEGINDATA
1,asdf,"assasadsdsdsd""sfasdfadf""sdsdsa,ssfsf"
2,sfjass,"dksadk,kd,ss""dfdfjkdjfdk""sasfjaslaljs"Loading:
SQL> Create table samp
2 (
3 no number,
4 col1 clob,
5 col2 clob
6 );
Table created.
SQL> host sqlldr scott/tiger control=c:\temp\samp.ctl log=c:\temp\samp.log
SQL> select * from samp
2 /
NO
COL1
COL2
1
asdf
assasadsdsdsd"sfasdfadf"sdsdsa,ssfsf
2
sfjass
dksadk,kd,ss"dfdfjkdjfdk"sasfjaslaljs
NO
COL1
COL2
SQL> SY. -
How to have a duplicate values for jtree components..
i'm trying to create a swing application with jtree.i'm getting the data from database in a single stretch.plz have a look at the below tree structure.
fint3
fint1
fint2
fint3
fint7
fint4
fint5
fint3
here the problem is i want to add a child under the last fint3.
fint3
fint1
fint2
fint3
fint7
fint4
fint5
fint3
fint8
my tree needs to be look like the above tree strucure.but i'm noy able to do that.instead of this
fint3
fint1
fint2
fint3
fint8
fint4
fint5
fint3
itz populating the tree shown above.
kindly guide me how to assign the hidden duplicate unique name for original data to insert the nodes properlyin my below post the structure of the tree is not populated properly.first fint3 is the root node
fint3
fint1
fint2 -
How to get only updated records for a column using loading type INSERT
Hi,
Good morning all,
I have source1 containg 3 columns bill_cd,bill_desc,bill_date and
source2 has the columns bill_cd,bill_key,source_id.
My target has the columns bill_cd,bill_date,bill_desc .
Now the requirement is, bill_cd in target should not repeated when we run the mapping more than one thime. it should get only updated records not the previous records using only INSERT Loading type(for target) not to use update/insert.
How can we achieve this logic in mapping level.
Anybody Please give me some solution immediately.
Thanks in Advance,
SivThanks Herzog for your reply,
Here bill_cd is not unique. Yes,I want only new records using INSERT as loading type. Suppose when the map runs for the first time, bill_cd is loaded with values 1 to 5.
Now, in the source I have got new records 6 to 10 for bill_cd and when I run the mapping again I need to get only records for bill_cd from 6 to 10 using INSERT as loading type.
Is it possible to achieve this at mapping level?
Regards,
Siv. -
How to create auto increment value in my column using identity ?
hi Team,
I have an requirement where i create an auto increment value ,with my table column
Create table Temp(
DeptID int IDENTITY(1,1) PRIMARY KEY,
Name varchar(50),
Emailid nvarchar(50),
Phone varchar(50)
so this is my table structure ,Here my column name is
Deptid here i need to creat an autoincrement value with today's date like below
ex:STM0000120012015
STM0000221012015
STM0000322012015(Currentdate)
.......................................... like this
Here i need only one column like identity column with the given incremental order,not more than one column
so can u pls help me out any one.
Thanks!Here the output came like this ,
1 STM0000120150121
2 STM0000220150121
3 STM0000320150121
4 STM0000420150121
5 STM0000520150121
6 STM0000620150121
7 STM0000720150121
8 STM0000820150121
9 STM0000920150121
10 STM00001020150121 --see this exceed length
and here i dnt need to increment that Stm000010,Here my output will come like this, idnt need to increment my charcter size
1 STM0000120150121
2 STM0000220150121
3 STM0000320150121
4 STM0000420150121
5 STM0000520150121
6 STM0000620150121
7 STM0000720150121
8 STM0000820150121
9 STM0000920150121
10 STM0001020150121
11 STM0001120150121
12 STM0001220150121
so here i dont need to increment my charcter length(16)
The length should be STM(3char)+00001(5Charcters)+CurrentDateFormat,
see the above suggested o/p
so can u pls help me out Dimant -
In my project,i am allowing user to select database of his choice from given options & i need to write queries considering
all these optional databases. So as per my one of requirement,is there any way to achieve generic functionality similar to ROW_NUMBER() in MSSQL ?First run this and check the db version
SELECT @@VERSION
EXEC sp_dbcmptlevel 'db name'
If version is above 2012 and compatibility level is above 80 ROW_NUMBER will work.
Otherwise you need to use this
http://sqlserverplanet.com/sql-2000/simulate-row_number-in-sql-2000
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
How does one give out enough spaces for a column in SQL report ?
How does one reserve enough spaces for a column in SQL report ?
Ex: 2 columns defined as the following
projectNo varchar2(10)
ProjectName varchar2(50)
When create an sql report, the report heading will show below. If my project name is " Tire Strength Test At Site R987654" . I need to get it to show in one line since it was defined as varchar2(50)
projectNo ProjectName
A0001 Tire Strength
Test At Site
R987654 There got to be a way to get around here . Thanx in advance.
taiI noticed the CSS Style settings only seem to work if using a "Standard Report Column". Unfortunately I have the need to define some report columns where undesired wrapping occurs as "Display as Text (based on LOV, does not save state)" and tried to avoid wrapping, but no luck - is there a way around this (other than performing the report query using a huge DECODE clause, which somewhat renders the LOV useless except for data entry)?
Thanks in advance for any ideas,
Holger -
How to load date with time zone using sql loader???
Hi All,
How to load following value in the table using SQL loader.
[11/Jan/2006:15:20:14 -0800]
What should be the datatype of the column in the table. I have tried with "timestamp with local time zone", but unable to load the record using sql loader. What should be the format string in the loader control file to load this type of record.
Any help in this regard is highly appreciated.
SameerTry something like this in your control file:
mycol char "TO_TIMESTAMP_TZ(mycol, 'DD/MON/YYYY:HH24:MI:SS TZH:TZM')"
[pre]
Message was edited by:
Jens Petersen -
Hi, I would like to know how can i break the value for a row and column once i have converted the image to the array. I wanted to make some modification on the element of the array at a certain position. how can i do that?
At the moment (as per attachhment), the value of the new row and column will be inserted by the user. But now, I want to do some coding that will automatically insert the new value of the row and the column ( I will use the formula node for the programming). But the question now, I don't know how to split the row and the column. Is it the value of i in the 'for loop'? I've tried to link the 'i' to the input of the 'replace subset array icon' , but i'm unable to do it as i got some error.
Please help me!
For your information, I'm using LABView 7.0.Hi,
Thanks for your reply.Sorry for the confusion.
I manage to change the array element by changing the row and column value. But, what i want is to allow the program to change the array element at a specified row and column value, where the new value is generated automatically by the program.
Atatched is the diagram. I've detailed out the program . you may refer to the comments in the formula node. There are 2 arrays going into the loop. If a >3, then the program will switch to b, where if b =0, then the program will check on the value of the next element which is in the same row with b but in the next column. But if b =45, another set of checking will be done at a dufferent value of row and column.
I hope that I have made the problem clear. Sorry if it is still confusing.
Hope you can help me. Thank you!!!!
Attachments:
arrayrowncolumn2.JPG 64 KB -
Hi Team,
R12 Instance :
Oracle Installed Base Agent User Responsibility --> Item Instances -->
Item Instance: Item Instances > View : Item Instance : xxxxx> Contracts : Item Instance : xxxxx> Service Contract: xxxxx>
In the above page there are two table regions.
Notes.
-------------------------------------Table Region---------------------------
Attachments
-------------------------------------Table Region---------------------------
--the attachments are shown using the query from the fnd_lobs and fnd_docs etc...
I want to know what are the document types are displayed in this page ?
--We developed a custom program to attach the attachments to the services contracts and the above seeded OAF page displays those ..as needed.
But after recent changes..the Attachments--> table region is not showing the attachments.
I have verified the query..and could not find any clue in that..
but i need some help if you guys can provide..
SELECT *
FROM
*(SELECT d.DOCUMENT_ID,*
d.DATATYPE_ID,
d.DATATYPE_NAME,
d.DESCRIPTION,
DECODE(d.FILE_NAME, NULL,
*(SELECT message_text*
FROM fnd_new_messages
WHERE message_name = 'FND_UNDEFINED'
AND application_id = 0
AND language_code = userenv('LANG')
*), d.FILE_NAME)FileName,*
d.MEDIA_ID,
d.CATEGORY_ID,
d.DM_NODE,
d.DM_FOLDER_PATH,
d.DM_TYPE,
d.DM_DOCUMENT_ID,
d.DM_VERSION_NUMBER,
ad.ATTACHED_DOCUMENT_ID,
ad.ENTITY_NAME,
ad.PK1_VALUE,
ad.PK2_VALUE,
ad.PK3_VALUE,
ad.PK4_VALUE,
ad.PK5_VALUE,
d.usage_type,
d.security_type,
d.security_id,
ad.category_id attachment_catgeory_id,
ad.status,
d.storage_type,
d.image_type,
d.START_DATE_ACTIVE,
d.END_DATE_ACTIVE,
d.REQUEST_ID,
d.PROGRAM_APPLICATION_ID,
d.PROGRAM_ID,
d.category_description,
d.publish_flag,
DECODE(ad.category_id, NULL, d.category_id, ad.category_id) category_id_query,
d.URL,
d.TITLE
FROM FND_DOCUMENTS_VL d,
FND_ATTACHED_DOCUMENTS ad
WHERE d.DOCUMENT_ID = ad.DOCUMENT_ID
*) QRSLT*
WHERE ((entity_name ='OKC_K_HEADERS_V'-- :1
AND pk1_value IN ( 600144,599046) --:2
AND category_id_query IN (1, :3, :4, :5, :6, :7) )
AND datatype_id IN (6,2,1,5)
AND (SECURITY_TYPE =4
OR PUBLISH_FLAG ='Y')))
--='000180931' -- 'ADP118'
The above seeded query is the one which is used for table region to retrieve the data..
how to know the dynamic values for this : AND category_id_query IN (1, :3, :4, :5, :6, :7) )
--SridharHi Patricia,
is it working for restricted key figure and calculated key figure ??
Note Number Fisc Period Opening Days
1 1 2
2 1 3
3 1 0
because I have other restriction, so I create two restricted key figure..
RK1 with restriction : Total Number of Note,
RK2 with restriction : Total Opening Days ,
then I Created a calculated key figure, average opening days in a period
CK1 = RK2 / RK1..
in this case, I am not sure if it will work or not..
for example, during RK2 calclation, it might be this 2+3 = 5, the line with 0 will be ignored..
during RK1 calcualtion, it might be 1 + 1 + 1 = 3. ---> Not sure in this case, the line with opening days 0 will be calculated or not..
could you please confirm..
Maybe you are looking for
-
Tax Error while posting Customer Invoice
Hello Everyone, When I try to post a customer invoice using one of the default tax code (eg. 1O - output tax 10%), during simulation the system gives following error message with the item list as below: "Error message still exist - see error log". Th
-
Getting rid of too much whitespace between rows of textfields
I'm creating a form with Arial, 8pt text fields (labels with associated textboses). I have too much whitespace between the rows of text fields. Is FormCentral flexible enough to allow me to set some property of the form to remove some of this white
-
I have a mid-2011 MacBook Air with the 251gb ssd, running 10.8.2 I was getting tight on room with 35gb left and so erased all downloads and a forty gig iPhoto library, then emptied the trash. Finder tells me now that I have 92gigs free which is corre
-
QS: want to change dbtimezone in Oracle9i
Dear Friends , I have to change my dbtimezone from '+00:00' to '+06:00' . How can I do it ? I m in from Asia/Dhaka zone . My present time status of the server is : SQL> select sessiontimezone from dual; SESSIONTIMEZONE +06:00 SQL> select dbtimezone f
-
Can someone send me Motivators eeprom
Hi All, I'm looking to fix my eeprom problem by flashing it after desoldering it from the motherboard. I need the schematic motivator had though and the instructions. If anyone has these can they email it Thanks T