Creating Interbase Stored Procedure 
Author Message
 Creating Interbase Stored Procedure

To any and all,

I seem to be having problems creating an Interbase stored procedure. I have a
table called UserProgramRights with a key field UserName. My SQL Server stored
procedure reads as follows


as
Select AccessRights from UserProgramRights

Can some kind person please educate me as to the syntax and method to include
this stored procedure into my Interbase database.

Thanks,
Regards
Charly



Thu, 12 Mar 1998 03:00:00 GMT  
 Creating Interbase Stored Procedure

Quote:

>I seem to be having problems creating an Interbase stored procedure. I have a
>table called UserProgramRights with a key field UserName. My SQL Server stored
>procedure reads as follows

>as
>Select AccessRights from UserProgramRights

>Can some kind person please educate me as to the syntax and method to include
>this stored procedure into my Interbase database.

Try something like the following SQL script:

  CONNECT "c:\delphi\test\atest.gdb" USER "SYSDBA" PASSWORD "masterkey";

  DROP PROCEDURE GetUserRights;

  SET TERM ^ ;

  CREATE PROCEDURE GetUserRights (UserID CHAR(2))
  RETURNS (Rights CHAR(10))
  AS
  BEGIN
    FOR SELECT ACCESSRIGHTS
    FROM USERPROGRAMRIGHTS
    WHERE USERNAME = :UserID
    INTO :Rights
    DO
      SUSPEND;
  END ^

  SET TERM ; ^

  COMMIT WORK;

**************************************************************************
Steve Koterski
Local InterBase Server Technical Support
Borland International, Inc.



Fri, 13 Mar 1998 03:00:00 GMT  
 Creating Interbase Stored Procedure


Quote:
>To any and all,

>I seem to be having problems creating an Interbase stored procedure. I have a
>table called UserProgramRights with a key field UserName. My SQL Server
stored
>procedure reads as follows


>as
>Select AccessRights from UserProgramRights

>Can some kind person please educate me as to the syntax and method to include
>this stored procedure into my Interbase database.

The information about Interbase DDL can be found in PDF format
in the manuals subdirectory.

The only part I wasn't sure about was what kind of a data type AccessRights
was.  I guessed at an integer but you can change it to whatever you want.

CREATE PROCEDURE GetUserRights (UserID char(2))
RETURNS (AccessRights integer)
AS
begin

   Select AccessRights from UserProgramRights
      Where UserName = :UserID
      into :AccessRights;

 exit;
end

If you want to run it in as a script, you need to change the terminator
to something other that semicolon.  I am using a ^ in the example below.

SET TERM ^ ;
CREATE PROCEDURE GetUserRights (UserID char(2))
RETURNS (AccessRights integer)
AS
begin

   Select AccessRights from UserProgramRights
      Where UserName = :UserID
      into :AccessRights;

 exit;
end
^
SET TERM ; ^
COMMIT WORK ;

Rodger                                 (MIME Welcome!)
---------
Rodger B. Zeisler - Everest Software Corporation              
Work: 214.437.7636  Fax: 214.437.7600  Home: 214.517.4884

----------



Sat, 21 Mar 1998 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Error creating cursor for stored procedure in InterBase

2. Using/Creating Oracle 7.3 Stored Procedures

3. Live resultsets from Interbase stored procedure?

4. BLOB FROM DELPHI TO INTERBASE STORED PROCEDURES

5. Interbase with views or stored procedures.

6. Local Interbase Server - Stored Procedures ?

7. Stored procedure question - Interbase NLM.

8. Interbase - stored procedures

9. Interbase with views or stored procedures.

10. Dynamic WHERE clause in Stored Procedures within INTERBASE ?

11. Granting Interbase privledges from within a stored procedure

12. Interbase Stored Procedures

 

 
Powered by phpBB® Forum Software