Teradata fastexport in ksh


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Teradata fastexport in ksh
# 1  
Old 02-02-2015
Teradata fastexport in ksh

Hi, I am trying to use Teradata fastexport in ksh, but getting error as below

Code:
 
 temp1.ksh: line 7: syntax error at line 10: `newline' unexpected

below is my code:

Code:
 
 #!/bin/ksh
  
 LOGON_STR="TDDB/user,paswd;"
DATAFILE=/path/a.lst;
DEBUG=0
  
 >$DATAFILE
  
 fexp > /dev/null 2>&1 <
.logon ${LOGON_STR}
.LOGTABLE   DATABASE.FExp_Log;
.BEGIN EXPORT  
 .EXPORT OUTFILE ${DATAFILE};
 SELECT
             '"'|| TRIM(col A)
||'"'||','||'"'||TRIM(col B)
||'"'||','||'"'||TRIM(col C)
||'"'||','||'"'||TRIM(col D)
||'"'||','||'"'||TRIM(col E)
||'"'||','||'"'||TRIM(col F)
FROM table;
.EXPORT RESET;
.LOGOFF;
.QUIT;

Pls suggest

Last edited by usrrenny; 02-02-2015 at 07:02 PM..
# 2  
Old 02-03-2015
You trying HERE input ?
syntax is
Code:
cmdline <<EndOfInputString
data
EndOfInputString

# ex.
cmdline <<EOF
data
EOF

This User Gave Thanks to kshji For This Post:
# 3  
Old 02-03-2015
Hi,
I am not trying any input. I am getting the specified error on the .logon statement. I removed the
Code:
> /dev/null 2>&1 <

next to the fexp. so it started running. but I am not getting any output, so after waiting fr 1 hour ,I had to killed the process.

Last edited by usrrenny; 02-03-2015 at 02:53 PM.. Reason: missed CODE tag
# 4  
Old 02-03-2015
If you are not trying any input, what is this?

Code:
logon ${LOGON_STR}
.LOGTABLE   DATABASE.FExp_Log;
.BEGIN EXPORT  
 .EXPORT OUTFILE ${DATAFILE};
 SELECT
             '"'|| TRIM(col A)
||'"'||','||'"'||TRIM(col B)
||'"'||','||'"'||TRIM(col C)
||'"'||','||'"'||TRIM(col D)
||'"'||','||'"'||TRIM(col E)
||'"'||','||'"'||TRIM(col F)
FROM table;
.EXPORT RESET;
.LOGOFF;
.QUIT;

It doesn't get fed into the program unless you ask it to feed it into the program.

You do that with this:

Code:
program ... <<EOF
logon ${LOGON_STR}
.LOGTABLE   DATABASE.FExp_Log;
.BEGIN EXPORT  
 .EXPORT OUTFILE ${DATAFILE};
 SELECT
             '"'|| TRIM(col A)
||'"'||','||'"'||TRIM(col B)
||'"'||','||'"'||TRIM(col C)
||'"'||','||'"'||TRIM(col D)
||'"'||','||'"'||TRIM(col E)
||'"'||','||'"'||TRIM(col F)
FROM table;
.EXPORT RESET;
.LOGOFF;
.QUIT;
EOF

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Minute(4) issue in teradata

I have values below for which diff field is giving error like "invalid time interval" in teradata Might be it is not doing calculation anymore after exceeding minute(4) value END_TS 2/2/2018 08:50:49.000000 START_TS 1/5/2018 17:30:02.000000 SLA_TIME 23:59:59.000000 select... (0 Replies)
Discussion started by: himanshupant
0 Replies

2. Shell Programming and Scripting

Connection with Teradata through shell Script

Hi All, As we are using SQLPLUS command to connect Oracle Database in unix: Like below syntax: sqlplus username/password@dbname << EOI SET HEADING OFF SPOOL MAX_DATE_VAL.txt select max(LAST_UPDT_DATE) from source_defect; SPOOL OFF here the result is stored in... (0 Replies)
Discussion started by: Shilpi Gupta
0 Replies

3. UNIX for Advanced & Expert Users

Teradata and Informatica Load constraints

HI Team , I have interesting issue observed when using teradata sql assistant(14.1) and Informatica tool (9.5) versions. I created SQL code in teradata where source count is 5000 records . I am using source and target database as teradata and trying to load using informatica tool . Its straight... (0 Replies)
Discussion started by: Perlbaby
0 Replies

4. UNIX and Linux Applications

Using BTEQ with perl to Teradata

Has anyone used either bteq or mload for inserting into a Teradata Database via perl. We're running Red Hat Enterprise 5.7. I've gotten the DBD::ODBC drivers installed and running. I installed the Teradata ICU, TeraGSS and ODBC pkgs. We are using perl to insert data across the network into... (1 Reply)
Discussion started by: islanderman
1 Replies

5. Programming

TeraData Sql to add months in timestamp

Hi , In teradata - how to add timestamp column with Varchar column values Output : In Exp_Date column it should add both 5/21/2012 14:00:00 and 24 ---> 5/21/2014 14:00:00 Please guide me on this . Thanks Please use code tags next time for your code and data. Thanks (1 Reply)
Discussion started by: Perlbaby
1 Replies

6. Shell Programming and Scripting

Execute teradata queries from a file

In a .txt file i have a set of teradata queries which i need to execute and capture result for all queries.Is there any way to run teradata queries from a file? (1 Reply)
Discussion started by: katakamvivek
1 Replies

7. Shell Programming and Scripting

Teradata connectivity through UNIX by use bteq

Hi, I want a script for connecting teradata to load the file to teradata table. Can you please help me out. Thanks in advance. (1 Reply)
Discussion started by: victory
1 Replies

8. Programming

Connect To Teradata

How do i connect from C program to teradata Database? The C program is being executed from a Unix script, AIX. I am calling a C program from a Unix shell script and the C Program executes some SQLs on Teradata Database. (3 Replies)
Discussion started by: yschd
3 Replies

9. Programming

compile a program in C with teradata sentences using cc

hi, I want to compile a program in C. It have a multiple calls to teradata. I have no idea how to compile in Aix. The compiler that I should be use is cc. I tried cc -G -KPIC tdsfbd0358.c this generates a tdsfbd0358.i and after I have no Idea what I have to make, a link? how?... (3 Replies)
Discussion started by: kajum
3 Replies

10. Programming

Unix - teradata

I am trying execute a sql file from the script and the sql file has the following code snippet, which throws out the error given below FOR C_FINELINE_LP AS CURSOR C_SLS FOR SELECT * FROM WM_UTIL.FLT_DEP WHERE LOAD_IND = 'N' DO ..... ..... .... END FOR; FOR C_FLTSLS_STR_LP AS... (0 Replies)
Discussion started by: yschd
0 Replies
Login or Register to Ask a Question