comp.lang.ada
 help / color / mirror / Atom feed
* ada and pl/sql
@ 2006-03-27 20:05 Jason King
  2006-03-27 20:28 ` Georg Bauhaus
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Jason King @ 2006-03-27 20:05 UTC (permalink / raw)


I'm a long-term pl/sql developer who would like to have a general 
purpose programming language that works a lot like what I'm used to. 
Hence I've been looking at Ada.
There are (from the pl/sql perspective) three significant differences:
1)  Transparent shifting from pl/sql to sql
     FOR x IN (SELECT user_name FROM all_users ) LOOP
         -- do something
     END LOOP ; -- creates a cursor and x.user_name is valid inside the 

                --loop
2)  pl/sql is very forgiving about doing "automatic" conversions
     x number := "1" + 2; -- assigns 3 to x it doesn't raise an error.
3)  The most commonly used string type is varchar2 with usage examples 
   below:
    v varchar2(50);  -- declare a varchar2, max length 50
    v varchar2(50) := 'short string';  -- assign a value, literal <50
                                       -- does not raise an error.
    v varchar2(10) := '12345678901' ;  -- raises value_error
                                       -- literal > max
declare
    v1 varchar2(10) := 'Hello';
    v2 varchar2(10) := 'World';
    v3 varchar2(30);
begin
    v3 := v1 || ' ' || v2 ; -- || is string concat operator.
                            -- no error here since 'Hello World'
                            -- fits.
    dbms_output.put_line(v3) ; -- prints "Hello World"

Issue 1 is true for all languages so I can just deal with it.
Issue 2 I often code around on the pl/sql as its automatic conversions 
aren't always what I want.
Issue 3 is a killer.
Ada string doesn't work because it raises errors for assignments of 
shorter as well as longer strings.  ada.strings.bounded and 
ada.strings.unbounded are issues because assignment (:=) doesn't work 
for them and concatenation is method not an operator.  As far as I can 
tell I can't overload the assignment operator or the || operator.
Other than creating a new language is there some way to make a 
varchar2-like first-class datatype that has its own operators?





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2006-03-29 19:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-27 20:05 ada and pl/sql Jason King
2006-03-27 20:28 ` Georg Bauhaus
2006-03-27 21:07 ` Björn Persson
2006-03-27 21:15   ` Martin Dowie
2006-03-27 23:28     ` Jason King
2006-03-28  2:53       ` Jeffrey Creem
2006-03-29 19:51         ` Martin Krischik
2006-03-29 19:47       ` Martin Krischik
2006-03-29 18:04 ` Kenneth Almquist

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox