Jonathan Sarabia wrote : >Hi, >I am development a report and I need a Stored Procedure for that. The thing is, I >need that SP to be dynamic, I >mean, I need to use prepared sentences. I looked for that kind of sentence and I did >what it is specified in the >SAPDB documents, however, when I tried to compile mi SP the following error was >reported: >---- Error -------------------------------
>Auto Commit: On, SQL Mode: Internal, Isolation Level: Committed >Syntax error or access violation;-5015 POS(66) Missing >keyword:WHILE,SELECT,IF,EXECUTE,CLOSE,SET,RETURN,LANGUAGE,FET. >create dbproc dba.test ( >in testvar varchar(5) ) >as >EXEC SQL BEGIN DECLARE SECTION; >I am working with SAPDB version 7.4, on Windows 2000. >Anybody have an idea of this error? >Thanks in advice. >Jonathan I'm not really sure to understand your question. What are 'prepared sentences' ? I assume you want to use dynamic sql inside a stored procedure, i.e. you want to create the sql statements inside the procedure at runtime. Here is an example how this can be achieved : CREATE DBPROC TEST (IN tablename CHAR(32)) AS VAR stmt CHAR(100); stmt = 'INSERT INTO ' || tablename || ' VALUES (1,2)'; execute stmt; Please note that compared to other embeddings the power of dynamic sql inside stored procedures is limited. Especially parameters are not supported. Best Regards, Thomas -- MaxDB Discussion Mailing List For list archives: http://lists.mysql.com/maxdb To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
