Create Stored Procedure

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Create Stored Procedure

    I have written two Stored Procedures, one for Oracle and one for SQL Server,
    that return NextID's from dynamic table/fields. My problem is that I have now
    written CF scripts to send to clients to run on their DB to create the Stored
    Procedures (sp) and neither of the scripts run correctly. I know the stord
    procedures are correct and really that is not the problem. The problem is that
    the script does not run correctly. For example, in Oracle, the query to
    generate the sp starts :

    <CFQUERY NAME="createSP" DATASOURCE="#dbDataSource#"
    USERNAME="#dbUserName#" PASSWORD="#dbPassword#">
    CREATE OR REPLACE PROCEDURE #storedProcedureName# (tableName IN varchar,
    fieldName IN varchar, extraParam IN varchar, orderField IN varchar, orderParam
    IN varchar, maxID OUT varchar, orderID OUT varchar)
    IS
    myTableName varchar(255);
    myColumnName varchar(255);
    myOrderField varchar(255);
    BEGIN

    maxID := 0 ;
    orderID := 0 ;

    ....

    End

    and this runs without problem. I go to Oracle (9i) and open the stored
    procedure and it shows that it has compiled with an error :

    "Line # = 1 Column # = 181 Error Text = PLS-00103: Encountered the symbol ""
    when expecting one of the following: ; is with authid as cluster order
    using external deterministic parallel_enable pipelined "

    Now if I copy the whole procedure within the Oracle environment and past it
    straight back in and compile it again, I get no errors. I make absolutely no
    change to any of the text.

    Now when I try to run a similar scripts in SQL Server, I get an error before
    the stored procedure is created which reads :

    "[Macromedia][SQLServer JDBC Driver][SQLServer]Line 115: Incorrect syntax near
    &apos;GO&apos;. Error Executing Database Query."

    But then when I go into the SQL Server EM, the stored procedure has been
    created and it compiles without error.

    Anyone have any ideas about any of this.

    Barb

    Snowcrash_10 Guest

  2. Similar Questions and Discussions

    1. Stored Procedure
      EXEC master..xp_cmdshell 'cscript c:\path\file.vbs' EXEC master..xp_cmdshell 'c:\path\file.exe' "Kannan" <gk_i@yahoo.com> wrote in message...
    2. stored procedure value
      How can I bind a stored procedure value to a page? I've executed a stored procedure and there should be two column values created...i.e. col1 and...
    3. help with a stored procedure
      I am new to postgres stored procedures and would like a little help. My function basically takes 2 arguments and inserts data into a table from a...
    4. need help on a stored procedure
      I have 2 tables. table1 and table2 I do a select on table1 and join table 2 on id. I want to check newprice in table1. if it is null, I want to...
    5. Re-create stored procedure in Oracle 8.0.5
      "Richard Foote" <richard.foote@bigpond.com> wrote in message news:<yVuT9.20373$jM5.56361@newsfeeds.bigpond.com>... Hm, it sound like a good...
  3. #2

    Default Re: Create Stored Procedure

    Woops, lied, the stored procedure in SQL Server doe snot get created at all. I
    had an old version in my DB. But when the error is thrown, I get an output of
    what the Create Stored Procedure statement looks like. If I copy this exactly
    into SQL Analyzer and run it, the SP gets created without error.

    Barb

    Snowcrash_10 Guest

  4. #3

    Default Re: Create Stored Procedure

    OK, I worked them both out. If you are interested, the SQL Server procedure do
    not require the GO at the bottom (no really) and the Oracle Procedure worked
    when I removed all the tabs and line returns (one very long single line).

    Barb

    Snowcrash_10 Guest

  5. #4

    Default Re: Create Stored Procedure

    Yeah, Go is not even a T-SQL command, let alone has a JDBC equivalent; its a
    command that is recognized by the SQL Server tools only e.g. Query Analyzer,
    SEM etc. For example you cant do multiple inserts with GO in between them from
    a cfquery.


    meatn2veg Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139