Sponsored Content
Top Forums Programming How to put variable date from SQL Script Post 302529735 by radoulov on Friday 10th of June 2011 09:30:35 AM
Old 06-10-2011
If I understand correctly, you don't need the external date command:


Code:
[...]
where 
  availableat 
between 
  trunc(sysdate)
and
  trunc(sysdate) + 1 - 1/24/60/60
;

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

script variable within a sql query

I created a script to read a csv file with four columns. The script also saved values of each col in a arry. In the script, i connected to db try to run a query to pull out data baisc on the values from the csv file. select Num from tableName where Sec_Num in ('${isin}') /*isin is an arry... (1 Reply)
Discussion started by: Sherry_Run
1 Replies

2. Shell Programming and Scripting

Convertion of Date Format using SQL query in a shell script

When I write Select date_field from TableA fetch first row only I am getting the output as 09/25/2009. I want to get the output in the below format 2009-09-25 i.e., MM-DD-YYYY. Please help (7 Replies)
Discussion started by: dinesh1985
7 Replies

3. Shell Programming and Scripting

Pass a variable to SQL script

Hi Guys, I like to pass a variable to a sql file in a unix script.. I tried a below code.. var=200903 db2 -vf test.sql 200903 test.sql is as below. select * from db2.users where quarter = $1; Please tell me where i go wrong.. Thanks in advance, Magesh (2 Replies)
Discussion started by: mac4rfree
2 Replies

4. UNIX for Dummies Questions & Answers

SQL loader script - ORACLE environmental variable

I am new in unix.. I am running a sql loader script where I have to specify the data file path but the file name contains spaces in it so giving error multiple arguments I have tried it with "" and '' but does n't work the command is : $ORACLE_HOME/bin/sqlldr... (1 Reply)
Discussion started by: Sandip Dey
1 Replies

5. Shell Programming and Scripting

How to put date range from a perl & sql script

Hi Guys, Can someone please help me on adding/inserting a variable date to an sql scipt? Basically I want to assign a 7 days date range. As shown below.. #!/usr/bin/perl use strict; use Env qw(ORACLE_HOME); my $SQLPLUS='/opt/oracle/product/10.1.0/db_1/bin/sqlplus -S... (1 Reply)
Discussion started by: pinpe
1 Replies

6. Shell Programming and Scripting

How to insert variable date (monthly) from SQL script

Hi Guys, Can someone please help me on adding/inserting a variable to an sql scipt? Basically I want to generate data on monthly (i.e. July 01, 2011 to July 31, 2011) basis. As shown below.. set head off; set linesize 300; set pagesize 200; spool /opt/oracle/temp/output.txt select... (1 Reply)
Discussion started by: pinpe
1 Replies

7. UNIX for Dummies Questions & Answers

SQL Script to use variable value from input file

Here is the requirement, When I run the "run file KSH (sql)", it should substitute '${pCW_Bgn_DT}' with 201120 and '${pCW_End_DT}' with 201124 Input File ---------- $ cat prevwk.dat 201124 20110711 run file KSH (sql) ------------------ In this file, I want to use the variables... (1 Reply)
Discussion started by: shanrice
1 Replies

8. Shell Programming and Scripting

Passing variable from file to sql from script

Hi Friend, I have one file in which some number are mentioned and number of lines are vary every time And i need to pass that number to my sql command from script. Suppose i have file acc.txt 45456546456 45464564565 67854353454 67657612132 Number of records are vary every time.... (20 Replies)
Discussion started by: pallvi_mahajan
20 Replies

9. Shell Programming and Scripting

Shell script variable $1 used with put command

I have the following script used, i am new to shell scripting. tryign to understand. in the put $BASE_FOLDER/$base_name holds which path. What does it mean by $1 second path in put command is it constructing this path: /user/hive/warehouse/stage.db/$1 what is $1 holding in above path. ... (2 Replies)
Discussion started by: cplusplus1
2 Replies

10. Shell Programming and Scripting

Append date to sql*plus spool (log) file in shell script

SQL*Plus version : 11.2.0.4 OS : Oracle Linux 6.5 SQL*Plus is a client application to connect to oracle database. The log file for this tool is generated via spool command as shown below. I am trying to append date ( $dateString ) to spool file as shown below. $ cat test2.sh #!/bin/bash... (4 Replies)
Discussion started by: kraljic
4 Replies
TRUNC(3)                                                     Linux Programmer's Manual                                                    TRUNC(3)

NAME
trunc, truncf, truncl - round to integer, toward zero SYNOPSIS
#include <math.h> double trunc(double x); float truncf(float x); long double truncl(long double x); Link with -lm. Feature Test Macro Requirements for glibc (see feature_test_macros(7)): trunc(), truncf(), truncl(): _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L DESCRIPTION
These functions round x to the nearest integer not larger in absolute value. RETURN VALUE
These functions return the rounded integer value. If x is integral, infinite, or NaN, x itself is returned. ERRORS
No errors occur. VERSIONS
These functions first appeared in glibc in version 2.1. ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7). +----------------------------+---------------+---------+ |Interface | Attribute | Value | +----------------------------+---------------+---------+ |trunc(), truncf(), truncl() | Thread safety | MT-Safe | +----------------------------+---------------+---------+ CONFORMING TO
C99, POSIX.1-2001, POSIX.1-2008. NOTES
The integral value returned by these functions may be too large to store in an integer type (int, long, etc.). To avoid an overflow, which will produce undefined results, an application should perform a range check on the returned value before assigning it to an integer type. SEE ALSO
ceil(3), floor(3), lrint(3), nearbyint(3), rint(3), round(3) COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. 2017-09-15 TRUNC(3)
All times are GMT -4. The time now is 09:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy