Sponsored Content
Top Forums Shell Programming and Scripting Truncating table from a shell script Post 302400310 by devtakh on Wednesday 3rd of March 2010 12:32:35 AM
Old 03-03-2010
Make sure you have permission to truncate the table with the user that you are logged in.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

update a oracle table using shell script

Hi, I would like to know how to update a table in Oracle database, if a command in one shell script either successfully completes or it fails.(like Y if its success or N if its a failure) While the command is running,I am able to view the log file created in the Unix machine.After the command... (2 Replies)
Discussion started by: ann_124
2 Replies

2. Shell Programming and Scripting

Reading a table in a shell script

Dear all: I want to write a script capable of reading specific rows and collumns of a table, into a variable. Just imagine i have a file named table.dat which contains: GENERAL INFORMATION Col 1 Col2 Col3 1 1 2 2 3 3 4 4 What i want to do... (13 Replies)
Discussion started by: luiscarvalheiro
13 Replies

3. Shell Programming and Scripting

Alter Table Shell Script

I want to add some columns to a existing tables through a shell script. Please help. (2 Replies)
Discussion started by: ankitgupta
2 Replies

4. Shell Programming and Scripting

To update a column in a table through shell script

Hi All, I need to write a shell script in UNIX that should accept booking number as an argument and update it with value "NULL" if the transaction date is greater than 2 years. Booking number and transaction_date are the two columns of the table table_booking. Something like this, through... (3 Replies)
Discussion started by: shilpa_acc
3 Replies

5. Shell Programming and Scripting

Create DB table through shell script

Hi, Can anyone tell me that, How to create table in Oracle database through shell script(ksh). Table contains 3 fields, 1] Emp ID, String, primary key 2] Name, String 3] B Date, date. Thanks in advance. (6 Replies)
Discussion started by: Poonamol
6 Replies

6. Shell Programming and Scripting

Shell script to query Oracle table

Hi, unix gurnis I need help for following requirement for writing a shell scritp. log in to oracle database, query one table total records (select count(*) from table1), pass the return value to a file. Thanks in advance (2 Replies)
Discussion started by: ken002
2 Replies

7. Shell Programming and Scripting

Shell Script Table

Hi, i need a bit help. I must write a script with shell- and sed-commands, which reads a table from stdin and writes a html-table on stdout (so i can open it with a web browser). The number of columns must be a parameter for the script, so i can start it for example with: "./htmltab.sh 3... (3 Replies)
Discussion started by: scruffytramp
3 Replies

8. Shell Programming and Scripting

Need to Print output in table using shell script

#! /bin/ksh #] && . ./.profile 2>/dev/null if test -f '.profile'; then . ./.profile; fi; #. .profile LOG_DIR=/app/rpx/jobs/scripts/just/logs sendEmail() { pzCType="$1"; pzTitle="$2"; pzMsg="$3"; pzFrom="$4"; pzTo="$5"; pzFiles="$6"; pzReplyTo="$7" ( ... (4 Replies)
Discussion started by: ankit.mca.aaidu
4 Replies

9. Homework & Coursework Questions

Help with pivoting table shell script

input file txt file 2000 1 name 2000 2 addr 2000 3 phone 2000 4 email 1000 1 name 1000 2 addr 1000 3 phone 1000 4 email 3000 1 name 3000 2 addr 3000 ... (4 Replies)
Discussion started by: senmatrix
4 Replies

10. Shell Programming and Scripting

Download a db table through UNIX shell script

Hi, I'm an amateur and need your help in figuring this out. I have been asked to connect to a prod db from non-prod env., and download a table from prod db to non-prod env. I was able to connect to the prod db and then run a simple query as below. @@@@@@@@@@ ... (7 Replies)
Discussion started by: arunpvp
7 Replies
truncate(2)							System Calls Manual						       truncate(2)

NAME
truncate, ftruncate - Changes file length SYNOPSIS
#include <unistd.h> int truncate( const char *path, off_t length); int ftruncate( int filedes, off_t length); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: ftruncate(), truncate(): XSH4.2 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Specifies the name of a file that is opened, truncated, and then closed. The path parameter must point to a pathname which names a regular file for which the calling process has write permission. If the path parameter refers to a symbolic link, the length of the file pointed to by the symbolic link is truncated. Specifies the descriptor of a file that must be open for writing. Specifies the new length of the file in bytes. DESCRIPTION
The truncate() and ftruncate() functions change the length of a file to the size in bytes specified by the length parameter. If the new length is less than the previous length, the truncate() and ftruncate() functions remove all data beyond length bytes from the specified file. All file data between the new end-of-file and the previous end-of-file is discarded. If the new length is greater than the previous length, one byte of zero (0x00) is written at the offset of the new length. The space in between the previous end-of-file and the new end- of-file is left as a hole; that is, no blocks are allocated to the space in between the previous last block and the new last block. Full blocks are returned to the file system so that they can be used again, and the file size is changed to the value of the length parame- ter. The truncate() and ftruncate() functions have no effect on FIFO special files or directories. These functions do not modify the seek pointer of the file. Upon successful completion, the truncate() and ftruncate() functions mark the st_ctime and st_mtime fields of the file for update. If the file is a regular file, the ftruncate() and truncate() functions clear the S_ISUID and S_ISGID attributes of the file. If the file has enforced file locking enabled and there are file locks on the file, the truncate() or ftruncate() function fails. RETURN VALUES
Upon successful completion, a value of 0 (zero) is returned. If the truncate() or ftruncate() function fails, it returns a value of -1, and errno is set to indicate the error. ERRORS
The ftruncate() and truncate() functions set errno to the specified values for the following conditions: [Tru64 UNIX] The write operation failed due to an enforced write lock on the file. [Tru64 UNIX] The file has enforced mode file locking enabled and there are file locks on the file. The length parameter was greater than the maximum file size. A signal was caught during execution. The length parameter was less than 0 (zero). [Tru64 UNIX] The file is not a regular file. An I/O error occurred while reading from or writing to a file system. [Tru64 UNIX] The process' root or current directory is located in a virtual file system that has been unmounted. In addition, the ftruncate() function sets errno to the specified values for the following conditions: [Tru64 UNIX] Write access permis- sion to the file was denied. The filedes parameter is not a valid file descriptor open for writing. The fildes parameter references a file that was opened without write permission. [Tru64 UNIX] The file resides on a read-only file system. In addition, the truncate() function fails if errors occur that apply to any service requiring pathname resolution, or if one of the fol- lowing are true: A component of the path prefix denies search permission, or write permission is denied on the file. The named file is a directory. Too many symbolic links were encountered in resolving path. The size of the pathname exceeds PATH_MAX or a pathname component is longer than NAME_MAX. A component of the specified pathname does not exist, or the path parameter points to an empty string. A compo- nent of the path prefix is not a directory. The file resides on a read-only file system. RELATED INFORMATION
Functions: chmod(2), fcntl(2), open(2) Standards: standards(5) delim off truncate(2)
All times are GMT -4. The time now is 10:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy