Sponsored Content
Top Forums Programming DB variable substitution in Pro*C Post 302358983 by jim mcnamara on Monday 5th of October 2009 11:23:20 AM
Old 10-05-2009
to_date takes a char
Code:
EXEC SQL BEGIN DECLARE SECTION;
static long db_sample_date_val=0;
static int db_sample_time_val=0;
static char something[32]={0x0};
EXEC SQL END DECLARE SECTION;

sprintf(something, "%d:%05d", db_sample_date_val, db_sample_time_val)
EXEC SQL
   INSERT
INTO sample_tbl(sample_dt)
VALUES (TO_DATE(:something, 'J:SSSSS'));

Also, do not neglect checking for sqlca.sqlcode < 0 after every sql operation.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Substitution in a variable

Hey All, I'm trying to clean up a variable using sed but It dosn't seem to work. I'm trying to find all the spaces and replace them with "\ " (a slash and a space). For Example "Hello World" should become "Hello\ World". But it does nothing. If I put it directly into the command line it works... (3 Replies)
Discussion started by: spragueg
3 Replies

2. UNIX for Dummies Questions & Answers

variable substitution

Hi everyone, I have a simple question to ask : In a script that I'm writting, I need to create variables on-the-fly. For instance, for every iterartion of the following loop a var_X variable should be generated : #!/bin/ksh a="1 2 3" for i in $a do var_${i}=$i echo "${var_$i}" done ... (1 Reply)
Discussion started by: ck-18
1 Replies

3. Shell Programming and Scripting

Variable Substitution

I have run into a wall with my iptables firewall scripting. I am blocking all of the private side IP addresses on the WAN interface on systems running NAT. However, if the system is not running NAT and needs to allow access to the local LAN on the WAN interface, I need to block all but one of... (2 Replies)
Discussion started by: garak
2 Replies

4. Shell Programming and Scripting

Sed variable substitution when variable constructed of a directory path

Hello, i have another sed question.. I'm trying to do variable substition with sed and i'm running into a problem. my var1 is a string constructed like this: filename1 filerev1 filepath1 my var2 is another string constructed like this: filename2 filerev2 filepath2 when i do... (2 Replies)
Discussion started by: alrinno
2 Replies

5. UNIX for Dummies Questions & Answers

Variable substitution

Hi, That might be pretty simple. How can I generate a variable name and get their value ? Thanks a lot. Something like: >CUSTOMER_NF=26 > object=CUSTOMER > echo ${object}_NF CUSTOMER_NF > echo ${${object}_NF} ksh: ${${object}_NF}: 0403-011 The specified substitution is... (7 Replies)
Discussion started by: Leo_NN
7 Replies

6. Shell Programming and Scripting

variable substitution

file1.ksh #!/bin/ksh test5_create="I am a man" # test5 will be dynamic and the value will be passed from command line a=${1}_create echo $a # i need the output as "I am a man" ./file1.ksh test5 # i run the script like this any suggessions guys... (1 Reply)
Discussion started by: giri_luck
1 Replies

7. Shell Programming and Scripting

Variable Substitution

Hi , I have a variable as follows, Temp=`cat ABC.txt | cut -c5-` This will yeild a part of the date. say , 200912. I would like to substitute this variable's value in a filename. eg: File200912F.zip when i say File$TempF.zip , it is not substituting. Any help ? Thanks in... (2 Replies)
Discussion started by: mohanpadamata
2 Replies

8. Shell Programming and Scripting

Variable substitution in awk

Hi, I have a variable to be substituted in awk. I am using AIX 5.3. Here is my piece of code: REPL_DT=`date +'%Y\\\\\\\\\/%m\\\\\\\\\/%d'` NEW_LINE=$(echo $Line | awk '{sub ($4, '$REPL_DT'); printf "# %-7s %9s %18s\n", $2,$3,$4}') sed $n" s/.*/$NEW_LINE/" kfile > tmp mv tmp kfile Here,... (2 Replies)
Discussion started by: sugan
2 Replies

9. Shell Programming and Scripting

How to use variable with command substitution in variable

For example I have variable like below echo $OUTPUT /some/path/`uname -n` when I try to use the variable OUTPUT like below cd $OUTPUT or cd ${OUTPUT} I am getting bad substituion error message $ cd $OUTPUT ksh: cd: bad substitution $ cd ${OUTPUT} ksh: cd: bad substitution ... (1 Reply)
Discussion started by: rajukv
1 Replies

10. Shell Programming and Scripting

Variable substitution

Hi, I have to write a shell script in which I have to substitute a variable within a variable. For example, var1=aaa var2=file.$var1.txt The output should be, echo $var2 file.aaa.txt Can someone please help me in getting this. I tried using eval, but it didnt work. I might be using it... (2 Replies)
Discussion started by: grajp002
2 Replies
SAVEPOINT(7)							   SQL Commands 						      SAVEPOINT(7)

NAME
SAVEPOINT - define a new savepoint within the current transaction SYNOPSIS
SAVEPOINT savepoint_name DESCRIPTION
SAVEPOINT establishes a new savepoint within the current transaction. A savepoint is a special mark inside a transaction that allows all commands that are executed after it was established to be rolled back, restoring the transaction state to what it was at the time of the savepoint. PARAMETERS
savepoint_name The name to give to the new savepoint. NOTES
Use ROLLBACK TO SAVEPOINT [rollback_to_savepoint(7)] to rollback to a savepoint. Use RELEASE SAVEPOINT [release_savepoint(7)] to destroy a savepoint, keeping the effects of commands executed after it was established. Savepoints can only be established when inside a transaction block. There can be multiple savepoints defined within a transaction. EXAMPLES
To establish a savepoint and later undo the effects of all commands executed after it was established: BEGIN; INSERT INTO table1 VALUES (1); SAVEPOINT my_savepoint; INSERT INTO table1 VALUES (2); ROLLBACK TO SAVEPOINT my_savepoint; INSERT INTO table1 VALUES (3); COMMIT; The above transaction will insert the values 1 and 3, but not 2. To establish and later destroy a savepoint: BEGIN; INSERT INTO table1 VALUES (3); SAVEPOINT my_savepoint; INSERT INTO table1 VALUES (4); RELEASE SAVEPOINT my_savepoint; COMMIT; The above transaction will insert both 3 and 4. COMPATIBILITY
SQL requires a savepoint to be destroyed automatically when another savepoint with the same name is established. In PostgreSQL, the old savepoint is kept, though only the more recent one will be used when rolling back or releasing. (Releasing the newer savepoint will cause the older one to again become accessible to ROLLBACK TO SAVEPOINT and RELEASE SAVEPOINT.) Otherwise, SAVEPOINT is fully SQL conforming. SEE ALSO
BEGIN [begin(7)], COMMIT [commit(7)], RELEASE SAVEPOINT [release_savepoint(7)], ROLLBACK [rollback(7)], ROLLBACK TO SAVEPOINT [roll- back_to_savepoint(7)] SQL - Language Statements 2010-05-14 SAVEPOINT(7)
All times are GMT -4. The time now is 07:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy