From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,f59d6c1c0a3dac5f,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!news.hub.org!sn-xt-sjc-03!sn-xt-sjc-06!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: Jason King Newsgroups: comp.lang.ada Subject: ada and pl/sql Date: Mon, 27 Mar 2006 14:05:10 -0600 Organization: Posted via Supernews, http://www.supernews.com Message-ID: <122gh5o729tsfcf@corp.supernews.com> Reply-To: jhking@airmail.net User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040616 X-Accept-Language: en-us, en MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@supernews.com Xref: g2news1.google.com comp.lang.ada:3656 Date: 2006-03-27T14:05:10-06:00 List-Id: 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?