Sponsored Content
Top Forums Shell Programming and Scripting Dynamic update loop query on Sybase database Post 302149935 by Alaeddin on Sunday 9th of December 2007 04:41:38 AM
Old 12-09-2007
Dynamic update loop query on Sybase database

Hello Guys,

I'm new to Shell scripting, and i need someone to help me with this issue:

I'm trying to do a dynamic update query on Sysbase database table using shell script.

Lets say, the Update query is "update Table set id=X" , where X is dynamic value for the loop index.
If the loop is from 1 to 3, the update query have to be for X=1, 2 and 3.

Any advice on how to write that.
Thanks.

- Alaeddin
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Connect to sybase database using Korn shell script

Hi, Can anyone please give me a script or let me know how to connect to a sybase database and execute a query using Korn shell scripts.Am new to Unix but i need to do this ASAP. Please help. Thanks, Gops (7 Replies)
Discussion started by: bhgopi
7 Replies

2. Shell Programming and Scripting

Print out loop index on the console after executing each sybase DB query

Hello Guys, Well, using shell script, I'm doing loop on DB query as below: isql -Usa -Ptest -I /opt/sybase/interfaces << EOF use testdb go declare @i int select @i = 1 while(@i <= 5) begin Insert into TEST values (@i,"Test","TestDesc") select @i = @i + 1 end go EOF The Issue... (2 Replies)
Discussion started by: Alaeddin
2 Replies

3. Programming

Need help with complex SQL query (Sybase)

Hello, I have three tables. I need an SQL query (preferably Sybase) that will return all of the stringID values of table B where the following conditions exist: (1) B.intID = A.intID (2) B.intID != C.intID or (B.intID = C.intID and (C.v1 = 0 or C.v2... (2 Replies)
Discussion started by: chatieremerrill
2 Replies

4. Windows & DOS: Issues & Discussions

how to connect to sybase database?

hi, I'd like to connect to a Sybase ASE 12 through a a graphic user interface (GUI) that run on windows and solaris10, because i need to do some querys. The database is running on solaris 10. I'm not an expert using databases, but i know how to use some SQL commands through command line... (3 Replies)
Discussion started by: danin
3 Replies

5. Shell Programming and Scripting

Execute stored procedure through script in sybase database and store the output in a .csv file

Hi, I have a sybase stored procedure which takes two input parameters (start_date and end_date) and when it get executed, it gives few records as an output. I want to write a unix script (ksh) which login to the sybase database, then execute this stored procedure (takes the input parameter as... (8 Replies)
Discussion started by: amit.mathur08
8 Replies

6. Shell Programming and Scripting

REINDEXING OF A DYNAMIC DATABASE

REINDEXING A DATABASE Hello, I have a database which in fact is a personal dictionary of a special kind to handle name homophones The structure is as follows: a=b=c=d=e=f This structure is an instruction to the program that whenever it encounters such a set of correlations it should treat them... (2 Replies)
Discussion started by: gimley
2 Replies

7. Programming

Hierarchical Query for Sybase database

Team I am using DBartisan tool for sybase database. I have a table that has below fields Employee_ID,EMP_Name,First_Nm,Last_Nm,Emp_Designation,Employee's_Manager is it possible to retrieve hierarchical data based on below fields Emp_Designation will have Soft Engg,SSE,Team Lead,... (6 Replies)
Discussion started by: Perlbaby
6 Replies

8. Programming

Sybase ASE: Query to find correct format issue.

Hi Team , I am new to Sybase Adaptive Server Enterprise/15.7 (ASE) and need some guidance to find the different values in serial format column. SELECT DISTINCT SERIAL_FORMAT FROM PRODUCTS It has values with below format which contains 12 digits hexadecimal characters with... (2 Replies)
Discussion started by: Perlbaby
2 Replies

9. Programming

Sybase ASE - Query Tuning - Need Suggestion

Dear Team Please provide suggestion on below query which is used in Sybase Adaptive Server Enterprise/15.7 (ASE). Query takes more time > 30 Mins to 1 Hr All required indexes are built Can we have any efficient approach to get the data retrieval faster for below query.Any help... (0 Replies)
Discussion started by: Perlbaby
0 Replies

10. Shell Programming and Scripting

Update a database table in a for loop

Im trying to update an informix database table for each occurance of a head_barcode in a file called mw within a for loop please see below - cant get the syntax correct. any help please? for a in `cat /tmp/mw` do sql image - << STOP > /dev/null 2>&1 update doc_table set status =... (4 Replies)
Discussion started by: worky
4 Replies
Net::DNS::Update(3)					User Contributed Perl Documentation				       Net::DNS::Update(3)

NAME
Net::DNS::Update - Create a DNS update packet SYNOPSIS
"use Net::DNS::Update;" DESCRIPTION
"Net::DNS::Update" is a front-end for creating "Net::DNS::Packet" objects to be used for making DNS dynamic updates. Programmers should refer to RFC 2136 for the semantics of dynamic updates. WARNING: This code is still under development. Please use with caution on production nameservers. METHODS
new $packet = Net::DNS::Update->new; $packet = Net::DNS::Update->new("example.com"); $packet = Net::DNS::Update->new("example.com", "HS"); Returns a "Net::DNS::Packet" object suitable for performing a DNS dynamic update. Specifically, it creates a packet with the header opcode set to UPDATE and the zone record type to SOA (per RFC 2136, Section 2.3). Programs must use the "push" method to add RRs to the prerequisite, update, and additional sections before performing the update. Arguments are the zone name and the class. If the zone is omitted, the default domain will be taken from the resolver configuration. If the class is omitted, it defaults to IN. Future versions of "Net::DNS" may provide a simpler interface for making dynamic updates. EXAMPLES
The first example below shows a complete program; subsequent examples show only the creation of the update packet. Add a new host #!/usr/bin/perl -w use Net::DNS; use strict; # Create the update packet. my $update = Net::DNS::Update->new("example.com"); # Prerequisite is that no A records exist for the name. $update->push("pre", nxrrset("foo.example.com. A")); # Add two A records for the name. $update->push("update", rr_add("foo.example.com. 86400 A 192.168.1.2")); $update->push("update", rr_add("foo.example.com. 86400 A 172.16.3.4")); # Send the update to the zone's primary master. my $res = Net::DNS::Resolver->new; $res->nameservers("primary-master.example.com"); my $reply = $res->send($update); # Did it work? if (defined $reply) { if ($reply->header->rcode eq "NOERROR") { print "Update succeeded "; } else { print "Update failed: ", $reply->header->rcode, " "; } } else { print "Update failed: ", $res->errorstring, " "; } Add an MX record for a name that already exists my $update = Net::DNS::Update->new("example.com"); $update->push("pre", yxdomain("example.com")); $update->push("update", rr_add("example.com MX 10 mailhost.example.com")); Add a TXT record for a name that doesn't exist my $update = Net::DNS::Update->new("example.com"); $update->push("pre", nxdomain("info.example.com")); $update->push("update", rr_add("info.example.com TXT 'yabba dabba doo'")); Delete all A records for a name my $update = Net::DNS::Update->new("example.com"); $update->push("pre", yxrrset("foo.example.com A")); $update->push("update", rr_del("foo.example.com A")); Delete all RRs for a name my $update = Net::DNS::Update->new("example.com"); $update->push("pre", yxdomain("byebye.example.com")); $update->push("update", rr_del("byebye.example.com")); Perform a signed update my $key_name = "tsig-key"; my $key = "awwLOtRfpGE+rRKF2+DEiw=="; my $update = Net::DNS::Update->new("example.com"); $update->push("update", rr_add("foo.example.com A 10.1.2.3")); $update->push("update", rr_add("bar.example.com A 10.4.5.6")); $update->sign_tsig($key_name, $key); Another way to perform a signed update my $key_name = "tsig-key"; my $key = "awwLOtRfpGE+rRKF2+DEiw=="; my $update = Net::DNS::Update->new("example.com"); $update->push("update", rr_add("foo.example.com A 10.1.2.3")); $update->push("update", rr_add("bar.example.com A 10.4.5.6")); $update->push("additional", Net::DNS::RR->new("$key_name TSIG $key")); Perform a signed update with a customized TSIG record my $key_name = "tsig-key"; my $key = "awwLOtRfpGE+rRKF2+DEiw=="; my $tsig = Net::DNS::RR->new("$key_name TSIG $key"); $tsig->fudge(60); my $update = Net::DNS::Update->new("example.com"); $update->push("update", rr_add("foo.example.com A 10.1.2.3")); $update->push("update", rr_add("bar.example.com A 10.4.5.6")); $update->push("additional", $tsig); BUGS
This code is still under development. Please use with caution on production nameservers. COPYRIGHT
Copyright (c) 1997-2002 Michael Fuhr. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
perl(1), Net::DNS, Net::DNS::Resolver, Net::DNS::Header, Net::DNS::Packet, Net::DNS::Question, Net::DNS::RR, RFC 2136, RFC 2845 perl v5.8.0 2002-05-30 Net::DNS::Update(3)
All times are GMT -4. The time now is 05:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy