Minute(4) issue in teradata


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Minute(4) issue in teradata
# 1  
Old 07-11-2018
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

Code:
END_TS 2/2/2018 08:50:49.000000
START_TS 1/5/2018 17:30:02.000000
SLA_TIME 23:59:59.000000


Code:
select (cast((cast(JRDC.END_TS as timestamp) -Cast(CAST( cast(JRDC.START_TS as DATE FORMAT 'YY/MM/DD') AS  TIMESTAMP(0)) + 
(SLA_TIME - TIME '00:00:00.000000' HOUR TO SECOND) as timestamp) minute(4)) +  CAST(1 AS interval minute) as decimal )) -1 as DIFF
from base_tbl.xyz


Last edited by rbatte1; 07-11-2018 at 01:01 PM.. Reason: Removed Bold for whole code block
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. Shell Programming and Scripting

Teradata fastexport in ksh

Hi, I am trying to use Teradata fastexport in ksh, but getting error as below temp1.ksh: line 7: syntax error at line 10: `newline' unexpected below is my code: #!/bin/ksh LOGON_STR="TDDB/user,paswd;" DATAFILE=/path/a.lst; DEBUG=0 >$DATAFILE fexp > /dev/null... (3 Replies)
Discussion started by: usrrenny
3 Replies

3. 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

4. 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

5. 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

6. Shell Programming and Scripting

Fast export in UNIX using Teradata creating issue

Hi All, I am trying to export a file using Fast Export (Teradata) in UNIX. The desired output length is 550 bytes, but the output file is creating string till 75 characters. How to get the full length file? .LOGON .EXPORT file=export.txt; SELECT CAST(('' || (CAST('UD ' AS CHAR(3))) || ... (2 Replies)
Discussion started by: unankix
2 Replies

7. Shell Programming and Scripting

Take minute per minute from a log awk

Hi, I've been trying to develop a script that performs the parsing of a log every 1 minute and then generating some statistics. I'm fairly new to programming and this is why I come to ask if I can lend a hand. this is my log: xxxx 16/04/2012 17:00:52 - xxxx714 - E234 - Time= 119 ms.... (8 Replies)
Discussion started by: jockx
8 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
MYSQLPROCGREP(1)						  MySQL Utilities						  MYSQLPROCGREP(1)

NAME
mysqlprocgrep - Search MySQL servers for processes matching a pattern SYNOPSIS
mysqlprocgrep [options] DESCRIPTION
This utility scans the process lists for the servers specified using instances of the --server option and selects those that match the con- ditions specified using the --age and --match-xxx options. For a process to match, all conditions given must match. The utility then either prints the selected processes (the default) or executes certain actions on them. If no --age or --match-xxx options are given, the utility selects all processes. The --match-xxx options correspond to the columns in the INFORMATION_SCHEMA.PROCESSLIST table. For example, --match-command specifies a matching condition for PROCESSLIST.COMMAND column values. There is no --match-time option. To specify a condition based on process time, use --age. Processes that can be seen and killed are subject to whether the account used to connect to the server has the PROCESS and SUPER privi- leges. Without PROCESS, the account cannot see processes belonging to other accounts Without SUPER, the account cannot kill processes belonging to other accounts To specify how to display output, use one of the following values with the --format option: grid (default) Display output in grid or table format like that of the mysql monitor. csv Display output in comma-separated values format. tab Display output in tab-separated format. vertical Display output in single-column format like that of the G command for the mysql monitor. OPTIONS
mysqlprocgrep accepts the following command-line options: --help Display a help message and exit. --age=<time> Select only processes that have been in the current state more than a given time. The time value can be specified in two formats: either using the hh:mm:ss format, with hours and minutes optional, or as a sequence of numbers with a suffix giving the period size. The permitted suffixes are s (second), m (minute), h (hour), d (day), and w (week). For example, 4h15m mean 4 hours and 15 minutes. For both formats, the specification can optionally be preceded by + or -, where + means older than the given time, and - means younger than the given time. --format=<format>, -f<format> Specify the output display format. Permitted format values are grid, csv, tab, and vertical. The default is grid. --kill-connection Kill the connection for all matching processes (like the KILL CONNECTION statement). --kill-query Kill the query for all matching processes (like the KILL QUERY statement). --match-command=<pattern> Match all processes where the Command field matches the pattern. --match-db=<pattern> Match all processes where the Db field matches the pattern. --match-host=<pattern> Match all processes where the Host field matches the pattern. --match-info=<pattern> Match all processes where the Info field matches the pattern. --match-state=<pattern> Match all processes where the State field matches the pattern. --match-user=<pattern> Match all processes where the User field matches the pattern. --print Print information about the matching processes. This is the default if no --kill-connection or --kill-query option is given. If a kill option is given, --print prints information about the processes before killing them. --regexp, --basic-regexp, -G Perform pattern matches using the REGEXP operator. The default is to use LIKE for matching. This affects the --match-xxx options. --server=<source> Connection information for a server to search in <user>[:<passwd>]@<host>[:<port>][:<socket>] format. Use this option multiple times to search multiple servers. --sql, --print-sql, -Q Instead of displaying the selected processes, emit the SELECT statement that retrieves information about them. If the --kill-connection or --kill-query option is given, the utility generates a stored procedure named kill_processes() for killing the queries rather than a SELECT statement. --sql-body Like --sql, but produces the output as the body of a stored procedure without the CREATE PROCEDURE part of the definition. This could be used, for example, to generate an event for the server Event Manager. When used with a kill option, code for killing the matching queries is generated. Note that it is not possible to execute the emit- ted code unless it is put in a stored routine, event, or trigger. For example, the following code could be generated to kill all idle connections for user www-data: $ mysqlprocgrep --kill-connection --sql-body > --match-user=www-data --match-state=sleep DECLARE kill_done INT; DECLARE kill_cursor CURSOR FOR SELECT Id, User, Host, Db, Command, Time, State, Info FROM INFORMATION_SCHEMA.PROCESSLIST WHERE user LIKE 'www-data' AND State LIKE 'sleep' OPEN kill_cursor; BEGIN DECLARE id BIGINT; DECLARE EXIT HANDLER FOR NOT FOUND SET kill_done = 1; kill_loop: LOOP FETCH kill_cursor INTO id; KILL CONNECTION id; END LOOP kill_loop; END; CLOSE kill_cursor; --verbose, -v Specify how much information to display. Use this option multiple times to increase the amount of information. For example, -v = verbose, -vv = more verbose, -vvv = debug. --version Display version information and exit. NOTES
For the --format option, the permitted values are not case sensitive. In addition, values may be specified as any unambiguous prefix of a valid value. For example, --format=g specifies the grid format. An error occurs if a prefix matches more than one valid value. EXAMPLES
For each example, assume that the root user on localhost has sufficient privileges to kill queries and connections. Kill all queries created by user mats that are younger than 1 minute: mysqlprocgrep --server=root@localhost --match-user=mats --age=-1m --kill-query Kill all connections that have been idle for more than 1 hour: mysqlprocgrep --server=root@localhost --match-command=sleep --age=1h --kill-connection COPYRIGHT
Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA AUTHOR
MySQL Utilities Team COPYRIGHT
2010, Oracle and/or its affiliates. All rights reserved. 1.0.3 May 09, 2012 MYSQLPROCGREP(1)