Help with GDL to SQL scripts


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help with GDL to SQL scripts
# 1  
Old 10-31-2005
Help with GDL to SQL scripts

Hi to everyone, i want ask if someone knows about a script/program to convert the .gdl (Interbase) to .sql scripts. I wrote a little script to make it but it's very very simple, and the triggers and some code from .gdl are so difficult to me. If somebody could help me, I would very thankful.

This is my script, only change a few reserved words.
PHP Code:
if test -"$1";
then
  
echo "Use : gdl2sql <script.gdl>"
  
exit;
fi

#cp $1 $1.back
cat $sed 's/define database/CREATE DATABASE/g' sed 's/define field/CREATE DOMAIN/g' > $1.sql
cat 
$1.sql sed 's/missing_value is/DEFAULT/g' sed 's/define relation/CREATE TABLE/g'  > $1.sql
cat 
$1.sql sed 's/short/INT/g' sed 's/char /CHAR/g' sed 's/long scale -2/NUMERIC(15,2)/g' > $1.sql
cat 
$1.sql sed '/security_class/d' sed 's/date/DATE/g' > $1.sql
cat 
$1.sql sed 's/valid if/CHECK/g' sed '/query_header/d' sed '/edit_string/d' > $1.sql
cat 
$1.sql sed 's/\[/\(/g' sed 's/\]/\)/g' sed 's/varying/VARCHAR/g' > $1.sql

cat 
$1.sql sed 's/define index/CREATE INDEX/g' sed 's/define trigger/CREATE TRIGGER/g' > $1.sql

cat 
$1.sql 

This is a sample code from the .gdl script
PHP Code:
/* This is a trigger */
define trigger POSTSTOREDETREL for RELATIONS_DETAIL
        post store 0
:
begin
  
for a in RELATIONS with a.relation = new.relation
  modify a using
    a
.import a.import + new.import;
  
end_modify;
  
end_for;
end;


/* This is a index */ 
define index MOVPOLMONTHYEAR for MOVEMENTS
        TICKET
,
        
MONTH,
        
YEAR;


/* This is a table */
define relation REINGRESO_TICKES
    TICKET     position 1
,
    
DATE_TICKET       position 2,
    
REFERENCE  position 3,
    
CAPTURE_DATE       position 4,
    
USER     position 5;


/* This is a domain */
define field IMPORT long scale -2
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Identify tables from Oracle sql scripts

Hi, Please let me know if you have any thoughts on how to read a table that has all the oracle sql files or shell scripts at the job and step level to identify all the tables that does merge, update, delete, insert, create, truncate, alter table (ALTER TABLE XYZ RENAME TO ABC) and call them out... (1 Reply)
Discussion started by: techmoris
1 Replies

2. Shell Programming and Scripting

UNIX Solution - Calling SQL*Plus scripts

I have a requirement of bash shell script calling SQL*Plus script. Shell Script sqlplus <user>/<pwd> @sqlscript1 parameters sqlplus <user>/<pwd> @sqlscript2 parameters Now I need the values generated by sqlscript1 in sqlscript2. But it is more like a huge dataset in a table and not one... (7 Replies)
Discussion started by: uuuunnnn
7 Replies

3. Shell Programming and Scripting

Issue in SQL Loader scripts

Hi, I'm planning to load the data from FLAT files into tables. Source file: more input.txt LRNO|Bale|Horsepower|NumberOfBarges|BollardPull|NumberOfCars|GasCapacity|GrainCapacity|IndicatedHorsepower|LiquidCapacity|... (6 Replies)
Discussion started by: shyamu544
6 Replies

4. UNIX for Advanced & Expert Users

Call parallel sql scripts from shell and return status when both sql are done

Hi Experts: I have a shell script that's kicked off by cron. Inside this shell script, I need to kick off two or more oracle sql scripts to process different groups of tables. And when both sql scripts are done, I will continue in the shell script to do other things like checking processing... (3 Replies)
Discussion started by: huasheng8
3 Replies

5. Shell Programming and Scripting

Execute multiple SQL scripts from single SQL Plus connection

Hi! I would like to do a single connection to sqlplus and execute some querys. Actually I do for every query one connection to database i.e echo 'select STATUS from v$instance; exit' > $SQL_FILE sqlplus user/pass@sid @$SQL_FILE > $SELECT_RESULT echo 'select VERSION from v$instance;... (6 Replies)
Discussion started by: guif
6 Replies

6. Shell Programming and Scripting

any possible solution on sql calling scripts

hi all, i have a function which will take i/p as a ddl sctipt as i/p and execute it, let function execute_sql { db_var="$1" v_cnt=`sqlplus -s XXXXX/XXXXX@aXXX << ENDSQL | sed -e "s/Connected\.//" -e "/^$/d" set pagesize 0 feedback off verify off heading off echo off serveroutput on size... (4 Replies)
Discussion started by: manas_ranjan
4 Replies

7. Shell Programming and Scripting

Calling SQL LDR and SQL plus scripts in a shell script

Hi- I am trying to achieve the following in a script so I can schedule it on a cron job. I am fairly new to the unix environment... I have written a shell script that reads a flat file and loads the data into an Oracle table (Table1) via SQLLDR. This Works fine. Then, I run a nested insert... (5 Replies)
Discussion started by: rajagavini
5 Replies

8. UNIX for Dummies Questions & Answers

SQL and shell scripts

Initial code is modified...Can u help me with the next post..... (3 Replies)
Discussion started by: Amruta Pitkar
3 Replies

9. Shell Programming and Scripting

Calling SQL scripts through Shell Script

Oracle and Scripting gurus, I need some help with this script... I am trying to add the query SELECT * FROM ALL_SYNONYMS WHERE SYNONYM_NAME = 'METADATA' in the current script.... Read the result set and look for the TABLE_NAME field. If the field is pointing to one table eg.... (18 Replies)
Discussion started by: madhunk
18 Replies

10. UNIX for Dummies Questions & Answers

Communitcating between UNIX and SQL Scripts

Hello all, With UNIX, they don't come any greener than me. Here's my question: I've written a UNIX script in which I execute SQL Scripts. In the last SQL Script, processing errors can occur that are not SQL problems and therefore the SQL script ends successfully. However, I want to be able... (0 Replies)
Discussion started by: andrewa1
0 Replies
Login or Register to Ask a Question