Newbie here, have a comment or two and need help.

"Tom Brennan" <[email protected]> Mon, 01 Sep 2003 23:55:43 +0000
Newsgroups gmane.comp.db.sapdb.general
Message-ID <[email protected]>
Hi,

Since I came from an SQL Server Background, I was hoping the coding of 
stored procedures would be more simpler or same as that of the SAP DB 7.4 
software on CD, that I recently acquired via post, however, I have a few 
opinions that may be of help to you in order to improve on a number of areas 
such as:
a) I found the documentation to be quite vague on understanding the syntax 
notation when it comes to learning SAP, perhaps a guide/tutorial for SQL 
Server programmers who are new to SAP?
b) So far, I have found no solid clues/examples in how to achieve certain 
tasks via the stored procedures, the enclosed code sample, mind you, this is 
my first stored procedure straight from my brain and typed it up in the SQL 
Studio app, only to be told of errors which I find very vague and not 
meaningful. Ideally, from my SQL Server background experience, the editor 
within SQL Server, will tell you the line number where the error is, can 
this be done with SAP's SQL Studio?
c) I am only new to this mailing list and will continue to peek at the 
mailing lists from time to time to see if there's anything useful. Why not 
bundle the mailing lists as archives on the CD?
d) This stored procedure is really bugging me and would appreciate any help. 
Basically, I have created a login table to hold various columns, and what I 
want to do is to check if a login id exists or not, if it doesn't then do an 
insert.This sounds trivial, but I cannot get it to work! :-( Any comments, 
correct way of doing this etc are appreciated. I have read the posting on 
stored procedures/transactions dated Monday 11th March 2002 by a 
[email protected] and have based the transaction code fom that posting.

create dbproc sp_add_login_dets(in login_id varchar(15), in login_passwd 
varchar(15),  in hq_ma_distributor_code varchar(15), in security_level 
integer, in login_revoked boolean) as
begin
    subtrans begin
        --Check the table for existing user!
        select
            user_id,
            sec_lvl_id,
            hq_ma_dstrbtr_code,
            user_pwd,
            revoked
        from login_tbl
        where
            user_id = :login_id and
            hq_ma_dstrbtr_code = :hq_ma_distributor_code;
    --rc of 100 means no row found
    if $rc = 100
    then
        begin
            --insert it into the table
            insert into login_tbl (:login_id, :security_level, 
:hq_ma_distributor_code, :login_passwd, :login_revoked);
            --rc of 0 means success
            if $rc = 0 then subtrans end
            else subtrans rollback
        end
end
/*
Get the following messages under SQL Studio 7.4.3.6...
Native Error: -5016
Text: [SAP AG][SQLOD32 DLL][SAP DB]General Error;-5016 POS(208) Missing 
delimiter: ;.
Click Ok, Error occurred. Execute next statement ?, Click Yes
Native Error: -3008
Text: [SAP AG][SQLOD32 DLL][SAP DB]Syntax error or access violation;-3008 
POS(260) Invalid keyword or missing delimiter.
Click Ok, Error occurred. Execute next statement ?, Click Yes
Native Error: -3005
Text: [SAP AG][SQLOD32 DLL][SAP DB]Syntax error or access violation;-3005 
POS(1) Invalid SQL statement.
Click Ok, Error occurred. Execute next statement ?, Click Yes
Native Error: -5006
Text: [SAP AG][SQLOD32 DLL][SAP DB]General Error;-5006 POS(24) Missing 
identifier.
Click Ok, Error occurred. Execute next statement ?, Click Yes
Native Error: -3005
Text: [SAP AG][SQLOD32 DLL][SAP DB]Syntax error or access violation;-3005 
POS(1) Invalid SQL statement.
Click Ok
*/

e) This statement
if exists (select *  from domain.dbprocedures where 
dbprocname=upper('sp_add_login_dets') = 1) then drop dbproc 
sp_add_login_dets
does not work? Why?

Thanking you for your time in reading this.
Tom.

P.S: Well done to ye guyz for open sourcing this what I'm sure is a 
wonderful database package. Shame that there's no decent tutorials in this! 
I will endevour to learn about this eagerly! Thanks again! :-)



/*
** #define p printf
** p("Better to reign in Hell, than to serve in Heaven");
** p("Email - [email protected]");
*/

_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. 
http://join.msn.com/?page=features/virus