Create "dynamic" statements in a stored procedure

hello
in my stored procedure I need to write a statement like this:
FUNCTION myfunct (mytable IN VARCHAR2)
BEGIN
EXECUTE IMMEDIATE
'SELECT COUNT(*)
INTO myvar
FROM ' || mytable ||
'WHERE mycol = ' || currval;
In short I need to create a sort of "dynamic" statement in which the tablename (nad other...) is a variable....
but I do not guess it's ok...
How can I do?

Hi,
With dyanmic SQL, the INTO clause is part of the EXECUTE IMMEDIATE statement, not the query.
Try something like this:
CREATE OR REPLACE FUNCTION     myfunct
(       mytable       IN     VARCHAR2
RETURN     PLS_INTEGER
IS
     return_num     PLS_INTEGER;
     sql_txt          VARCHAR2 (1000);
BEGIN
     sql_txt := 'SELECT  COUNT (*)'
          || ' FROM ' || mytable;
     dbms_output.put_line (sql_txt || ' = sql_txt in myfunct');
--     EXECUTE IMMEDIATE sql_txt INTO return_num;
     RETURN     return_num;
END     myfunct
/It's a good idea to develop dynamic SQL as shown above; putting the dynamic statement into a variable that can easily be displayed for debugging.
When it looks right, then un-comment the EXECUTE IMMEDAITE statement.
Before moving the code into Production, comment out (or remove) the put_line statement.

Similar Messages

  • JDBC/select/async statement to JDBC/stored procedure/sync call

    Hi
    We have JDBC/select/async statement to JDBC/stored procedure/sync call i.e sender and receiver are JDBC.
    PI has to pick all the the records of single internal order number at a time from sender system and upload to receiver JDBc,
    gets the response and routes to sender/insert statement.
    This should run only once per day.
    We will have multiple Internal orders daily, each order consisting of 10 to 20 records but only one IO related records has
    to upload to Receiver/JDBC
    What are the options available ?
    We have thought of following options
    1. SQL query is already to pick, but we have to pick records at one time daily. example: morning,evening or midnight.
       At that time it can pick multiple times but it should not pick through out day
    2. Is there any option in BPM so that we can group IO's at a time and upload ? If so what are the steps need to use
       Any additonal receive step need to be used to pick the records from the table.
    Thanks

    hi
    as i can understando you, you will receive mani IO and you must execute one IO in the receiver SP? if so, you can solve this usssing a ccBPM where you will have to create a mapping(0.N) where the source and the target structure will be the same, the diferrence will be in the occurrance of the target structure which will have to be 0.N (Tab signature in Message Mapping). then back to the ccBPM define a block with the property ForEach. this will  loop any times accord with the number of IO that you receive from the sender. as a result you will execute one SP for each IO.
    so, you ccBPM will be
    RS>TS>BLOCK(Multiline container and single container of source structure)>TS->SS
    RS:Receive Step
    TS:Trans. Step
    SS:Send Step
    Also the container will be:
    source--> type Abs
    source_multiline --> type Abs
    target -->type Abs
    Thanks
    Rodrigo P.
    Edited by: Rodrigo Alejandro Pertierra on Jun 24, 2010 4:54 PM

  • DDL Statements in a Stored Procedure

    Is there some technique which can be used to execute DDL statements in a stored procedure? I want to drop and recreate a table and a number of indexes. Is there a way for me to do this within a stored procedure?
    Thanks in advance for your assistance!!!

    BEGIN
       EXECUTE IMMEDIATE 'CREATE TABLE bonus (id NUMBER, amt NUMBER)';
    END;http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96624/13_elems18.htm#33889

  • Writing mulitple sql statements in 1 stored procedure

    Hi all, can i know how to create mulitple sql statements in 1 stored procedure??
    Eg the first sql statement will generate few results and my second sql statement will based on the first statement result to execute its second results and my third sql statements will on the second results to generate the final results which will be passed back to jsp pages as a resultset??
    For the time being, i only know how to create a single sql statement in one stored procedure..i had surf through the oracle website but cant find any solution. Can anyone help me?? Samples or links to any website will do.. Thanks alot...

    Hi Irene,
    If I understand your question correctly, then I have already written
    a similar (PL/SQL) stored procedure without any problems.
    However, I do think your question is more suited to the following
    forum:
    http://forums.oracle.com/forums/forum.jsp?id=478021
    I also think it will help others to answer your question if you
    include the following information:
    1. Version of Oracle you are using.
    2. The error message you are getting.
    3. The part of your code that is causing the problem.
    Also, have you looked at the following web sites?
    http://asktom.oracle.com
    http://metalink.oracle.com
    Good Luck,
    Avi.

  • How to dynamically create sqlldr control file using stored procedure

    I am trying to dynamically create the control file (.ctl) and execute the same using a stored procedure.I would be passing the file name as a parameter to this procedure. How do I go about doing this?
    The control file has the following structure. The file name (mktg) varies and is passed as an input to the stored procedure.
    SPOOL mktg.ctl
    LOAD DATA
    INFILE 'mktg.csv'
    INTO TABLE staging
    FIELDS TERMINATED BY ','
    TRAILING NULLCOLS
    (COMPANY_NAME,
    ADDRESS,
    CITY,
    STATE,
    ZIP)
    SPOOL OFF ;
    sqlldr scott/tiger CONTROL= mktg.ctl LOG=mktg.log BAD=mktg.bad

    We are using oracle 9i rel 2.
    I have not had much success with the creation of log and bad files using external tables when they are being used within a dynamic sql.
    Plz check this:
    Re: problems related to data loads from excel, CSV files into an oracle 9i db

  • DDL statement/s in stored procedures (FUNCTION)

    Hello all,
    I was trying to create a small function that tests keywords on the basis of successful/failed table creation. If a table can be created with a keyword as identifier, it is a non-reserved keyword, if table creation fails, it is a reserved keyword:
    CREATE OR REPLACE FUNCTION createTableForKeyword (keyword VARCHAR) RETURN BOOLEAN IS
    BEGIN
    CREATE TABLE keyword (x NUMBER);
    -- if no exception occurred, table creation succeeded
    DROP TABLE keyword; drop it
    RETURN FALSE; -- FALSE means non-reserved
    EXCEPTION
    WHEN OTHERS THEN
    -- if exception occurred, table creation failed
    RETURN TRUE; -- TRUE means reserved
    END createTableForKeyword;
    This would have been my first PL/SQL program, but I get the following error:
    PLS-00103: Found symbol "CREATE" when expecting one of:
    begin case declare exit ................
    .............. merge pipe
    I had to translate the error message from German, but it should suffice. Obviously DDL statements in functions are not allowed. How do I solve my problem then, given a table that has one column containing the keyword?:
    CREATE TABLE Keywords (keyword VARCHAR(30));
    I was looking too call this function from a loop, but how would I do this without a function? How do I capture table creation fails without exceptions in functions?
    TIA
    Karsten

    To run DDL inside stored procedure you must use Dynamic SQL. Use EXECUTE IMMEDIATE
    To see if a word is a reserved word just query V$RESERVED_WORDS
    Thanks,
    Karthick.

  • Help: Creating a report based on STORED PROCEDURE in Oracle DB

    Hi,
    We are creating an application with FORMS and REPORTS. A set of stored procedures were created for the FORMS and the ref cursor from the select statement are the same for the REPORTS.
    Is there a way that directly use relevant stored procedure to create REPORTS and how?
    Thanks in advance.
    Jimmy

    What I am really interested in is calling STORED PEOCEDURE in DB, not the one that attached with report. What good about this is that the procedures can be shared by FORMS and REPORTS. REPORTS call the procedure with select statement.
    Thanks.

  • ORA-29855 - Error creating Spatial Index using a Stored Procedure

    Hi
    I am using Oracle 10gR2 database and I have written a stored procedure to create spatial index. But when i execute this function i get the following error message.
    ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
    ORA-13249: internal error in Spatial index: [mdidxrbd]
    ORA-13249: Error in Spatial index: index build failed
    ORA-13249: Error in R-tree: [mdrcrtscrt]
    ORA-13231: failed to create index table [MDRT_217C1$] during R-tree creation
    ORA-13249: Stmt-Execute Failure: CREATE TABLE FGDABZ40.MDRT_217C1$ (NODE_ID NUMBER, NODE_LEVEL NUMBER, INFO BLOB) LOB (INFO) STORE AS (CACHE) NOLOGGING PCTFREE 2
    ORA-29400: data cartridge error
    ORA-01031: insufficient privileges
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD_10I", line 10
    ORA-06512: at line 1
    ORA-06512: at "FGDABZ40.PKG_PSSDBE_APPLICATION", line 298
    ORA-06512: at line 17
    The tables that i am passing are registered in metadata and I am able to create indexes directly in sql plus. But when i try to create using this stored procedure, it fails.
    it should be possible to create indexes using a generic function. Has any faced a similar problem?
    regards
    sam

    Hi,
    I am having a same error on Oracle 10gR2 database. When I execute the same statement in sqlplus, it works. But it gives this error when I call the procedure which has this create spatial index statement.
    ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
    ORA-13249: internal error in Spatial index: [mdidxrbd]
    ORA-13249: Error in Spatial index: index build failed
    ORA-13249: Error in R-tree: [mdrcrtscrt]
    ORA-13231: failed to create index table [MDRT_20CDA$] during R-tree creation
    ORA-13249: Stmt-Execute Failure: CREATE TABLE "SDOMGR".MDRT_20CDA$ (NODE_ID NUMBER, NODE_LEVEL NUMBER, INFO BLOB) LOB (INFO) STORE AS (CACHE) NOLOGGING PCTFREE 2
    ORA-29400: data cartridge error
    ORA-01031: i
    Any help will be appreciated.
    Thanks,
    Sri

  • Callable statement with oracle stored procedure error

    i'm calling a stored procedure in java with the following code. However i constantly recieve this error
    so what is going on please HELP
    Parameter Type Conflict: sqlType=2006
    my call statement would be this:
    call Statement = {call getUserByLogin(?,?,?,?)}
    if(storedProcedureName=="getUserByLogin"){
    strCStmt = ("{call " + storedProcedureName +"(?,?,?,?) }");
    cStmt.setObject(1, "system");
    cStmt.setObject(2, "username");
    cStmt.setObject(3,"password");
    cStmt.registerOutParameter(4, java.sql.Types.REF);
    rs = cStmt.executeQuery();
    i've also tried it with a setString as the IN parameter:
    here's the stored procedure:
    CREATE OR REPLACE PROCEDURE getUserByLogin (
    arg_subscriptionName IN varchar,
    arg_loginName IN varchar,
    arg_password IN varchar,
    arg_rec_userinfo_valLanguage OUT types.rec_userinfo_valLanguage
    ) AS
    var_userNum int;
    BEGIN
    select
    u.userNum into var_userNum
    from
    userInfo u,
    subscription s
    where
    s.subscriptionName = arg_subscriptionName AND
    s.subscriptionNum = u.subscriptionNum AND
    u.loginName = arg_loginName AND
    u.password = arg_password;
    if (var_userNum is null) then
    var_userNum := 0;
    end if;
    getUser(var_userNum, arg_rec_userinfo_valLanguage);
    END;

    i'm calling a stored procedure in java with the
    following code. However i constantly recieve this
    error
    so what is going on please HELP
    Parameter Type Conflict: sqlType=2006
    my call statement would be this:
    call Statement = {call getUserByLogin(?,?,?,?)}
    if(storedProcedureName=="getUserByLogin"){
    strCStmt = ("{call " + storedProcedureName +"(?,?,?,?)
    cStmt.setObject(1, "system");
    cStmt.setObject(2, "username");
    cStmt.setObject(3,"password");
    cStmt.registerOutParameter(4, java.sql.Types.REF);
    rs = cStmt.executeQuery();
    i've also tried it with a setString as the IN
    parameter:
    here's the stored procedure:
    CREATE OR REPLACE PROCEDURE getUserByLogin (
    arg_subscriptionName IN varchar,
    arg_loginName IN varchar,
    arg_password IN varchar,
    arg_rec_userinfo_valLanguage OUT
    types.rec_userinfo_valLanguage
    ) AS
    var_userNum int;
    BEGIN
    select
    u.userNum into var_userNum
    from
    userInfo u,
    subscription s
    where
    s.subscriptionName = arg_subscriptionName AND
    s.subscriptionNum = u.subscriptionNum AND
    u.loginName = arg_loginName AND
    u.password = arg_password;
    if (var_userNum is null) then
    var_userNum := 0;
    end if;
    getUser(var_userNum, arg_rec_userinfo_valLanguage);
    END;
    /Hai,
    Try with this if u are using Oracle.
    import oracle.sql.*;
    import oracle.jdbc.driver.*;
    (inbetween ur code)
    cStmt.registerOutParameter(4, OracleTypes.CURSOR);
    //in place of "cStmt.registerOutParameter(4, java.sql.Types.REF);"
    Hope u reply with joy.
    regards,
    Siva Kumar Annavaram

  • User can Execute SQL Statement but not Stored Procedure

    I have a function in Access that calls a stored procedure to update a table. When I run it, it works fine but when the users try to run it, they get an error.
    If I change it run the actual SQL syntax that is in the stored procedure then the users can run it and update the table without any problems, which makes no sense to me. It's doing the same exact thing as the stored procedure. I'd much rather have them be
    able to run the procedures then writing the SQL in VBA modules because that's going to end up being a lot of code.
    Any idea on why it's like this and how to correct it? Any assistance would be appreciated.

    Hello,
    When you give a user permission to run a stored procedure, everything on that procedure but Dynamic SQL will be executed
    without evaluating user permissions on the objects the stored procedure deals with.
    On the link I provided above, you will see how to provide permissions to stored procedures. Try creating database roles, add user to database roles, then assign permissions to database roles.
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • Create a View, function or stored procedure for query?

    Hi All,
    I like to know how I can create a view or function for the query below. If its going to be a function or stored procedure will I be able to union it with another view?
    DECLARE
    @BegDate DATE,
    @EndDate DATE
    SELECT
    @BegDate = MIN(vl.VoidStartDate),
    @EndDate = MAX(vl.LetDate)
    FROM #VoidLoss vl
    ;WITH d(d) AS (
    SELECT TOP (DATEDIFF(dd, @BegDate, @EndDate))
    DATEADD(dd, ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) -1, @BegDate)
    FROM sys.all_objects o
    ), cal AS (
    SELECT
    d.d,
    MONTH(d.d) AS m,
    YEAR(d.d) AS y
    FROM d
    SELECT
    vl.History_IND,
    vl.PropCode,
    vl.VoidCategory,
    vl.ControlGroup,
    CASE WHEN vl.VoidStartDate < MIN(cal.d) THEN MIN(cal.d) ELSE vl.VoidStartDate END AS VoidStartDate,
    CASE WHEN vl.LetDate > MAX(cal.d) THEN MAX(cal.d) ELSE vl.LetDate END AS LetDate,
    vl.MarketRent,
    DATENAME(mm, CAST('1900-' + CAST(cal.m AS VARCHAR(2)) + '-1' AS DATE)) AS [Month],
    cal.y AS [Year],
    COUNT(*) AS DaysVoid,
    COUNT(*) * vl.MarketRent AS VoidLoss
    FROM
    #VoidLoss vl
    JOIN cal
    ON cal.d BETWEEN DATEADD(dd, 1, vl.VoidStartDate) AND vl.LetDate
    GROUP BY
    vl.History_IND,
    vl.PropCode,
    vl.VoidCategory,
    vl.ControlGroup,
    vl.VoidStartDate,
    vl.LetDate,
    vl.MarketRent,
    cal.m,
    cal.y
    ORDER BY
    vl.History_IND,
    vl.PropCode,
    vl.VoidStartDate
    Thanks

    A view or an inline-function is a single query, so this part does not fit in:
    DECLARE
    @BegDate DATE,
    @EndDate DATE
    SELECT
    @BegDate = MIN(vl.VoidStartDate),
    @EndDate = MAX(vl.LetDate)
    FROM #VoidLoss vl
    And you cannot have it multi-statement function either, since you cannot refer to temp tables in such a function. In any case, using a multi-statement function in a view definition or nest it in another function definition is likely to be a performance disaster.
    The sole alternative that remains as long as you have the temp table is a stored procedure. You cannot use a stored procedure in a view or a function.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Privilege for creating a View from a Stored Procedure

    Hi,
                         I need to create a view from a procedure. I could do it from an anonymous block whereas I am unable to do that from a Stored Procedure. Should I need a specific privilege for performing this operation? If so what would be the reason behind it? Will that privilege be given in production databases?
    Code to replicate:
    CREATE TABLE t11 AS SELECT * FROM DUAL;
    CREATE OR REPLACE PROCEDURE p_etl_test_view
    AS
    BEGIN
       EXECUTE IMMEDIATE 'CREATE OR REPLACE VIEW v_t11 AS SELECT * FROM t11';
    END;
    PROCEDURE P_ETL_TEST_VIEW compiled
    Elapsed: 00:00:00.131
    BEGIN
       EXECUTE IMMEDIATE 'CREATE OR REPLACE VIEW v_t11 AS SELECT * FROM t11';
    END;
    anonymous block completed
    Elapsed: 00:00:00.069
    BEGIN
       p_etl_test_view;
    END;
    Error starting at line 13 in command:
    BEGIN
       p_etl_test_view;
    END;
    Error report:
    ORA-01031: insufficient privileges
    ORA-06512: at "OCCSS_ENTMT_HK_DEV_01.P_ETL_TEST_VIEW", line 4
    ORA-06512: at line 2
    01031. 00000 -  "insufficient privileges"
    *Cause:    An attempt was made to change the current username or password
               without the appropriate privilege. This error also occurs if
               attempting to install a database without the necessary operating
               system privileges.
               When Trusted Oracle is configure in DBMS MAC, this error may occur
               if the user was granted the necessary privilege at a higher label
               than the current login.
    *Action:   Ask the database administrator to perform the operation or grant
               the required privileges.
               For Trusted Oracle users getting this error although granted the
               the appropriate privilege at a higher label, ask the database
               administrator to regrant the privilege at the appropriate label.
    Elapsed: 00:00:00.100
    The privileges I am having:
    SELECT   *
        FROM dba_sys_privs
       WHERE grantee = 'OCCSS_ENTMT_HK_DEV_01'
          OR grantee IN (SELECT granted_role
                           FROM dba_role_privs
                          where grantee = 'OCCSS_ENTMT_HK_DEV_01')
    ORDER BY 1;
    GRANTEE
    PRIVILEGE
    ADMIN_OPTION
    EXP_FULL_DATABASE
    ADMINISTER RESOURCE MANAGER
    NO
    EXP_FULL_DATABASE
    ADMINISTER SQL MANAGEMENT OBJECT
    NO
    EXP_FULL_DATABASE
    BACKUP ANY TABLE
    NO
    EXP_FULL_DATABASE
    CREATE SESSION
    NO
    EXP_FULL_DATABASE
    CREATE TABLE
    NO
    EXP_FULL_DATABASE
    EXECUTE ANY PROCEDURE
    NO
    EXP_FULL_DATABASE
    EXECUTE ANY TYPE
    NO
    EXP_FULL_DATABASE
    READ ANY FILE GROUP
    NO
    EXP_FULL_DATABASE
    RESUMABLE
    NO
    EXP_FULL_DATABASE
    SELECT ANY SEQUENCE
    NO
    EXP_FULL_DATABASE
    SELECT ANY TABLE
    NO
    OCCSS_ENTMT_HK_DEV_01
    CREATE DATABASE LINK
    NO
    OCCSS_ENTMT_HK_DEV_01
    CREATE TABLE
    NO
    OCCSS_ENTMT_HK_DEV_01
    DEBUG CONNECT SESSION
    NO
    OCCSS_ENTMT_HK_DEV_01
    SELECT ANY DICTIONARY
    NO
    SCB_SCHEMA_ROLE
    ALTER SESSION
    NO
    SCB_SCHEMA_ROLE
    CREATE CLUSTER
    NO
    SCB_SCHEMA_ROLE
    CREATE DIMENSION
    NO
    SCB_SCHEMA_ROLE
    CREATE INDEXTYPE
    NO
    SCB_SCHEMA_ROLE
    CREATE JOB
    NO
    SCB_SCHEMA_ROLE
    CREATE MATERIALIZED VIEW
    NO
    SCB_SCHEMA_ROLE
    CREATE OPERATOR
    NO
    SCB_SCHEMA_ROLE
    CREATE PROCEDURE
    NO
    SCB_SCHEMA_ROLE
    CREATE SEQUENCE
    NO
    SCB_SCHEMA_ROLE
    CREATE SESSION
    NO
    SCB_SCHEMA_ROLE
    CREATE SYNONYM
    NO
    SCB_SCHEMA_ROLE
    CREATE TABLE
    NO
    SCB_SCHEMA_ROLE
    CREATE TRIGGER
    NO
    SCB_SCHEMA_ROLE
    CREATE TYPE
    NO
    SCB_SCHEMA_ROLE
    CREATE VIEW
    NO

    BoopathyVasagam wrote:
    Thank you for your answer. So should I issue the below statement? (Since I dont have dba privs i couldn't test this)
    GRANT CREATE VIEW to P_ETL_TEST_VIEW;
    I doubt that above will prevent the error from being thrown.
    prior to running anonymous block again; just do as below
    SET ROLE NONE;
    doing so should result in same error being thrown when invoking
    BEGIN 
       p_etl_test_view; 
    END; 

  • Dynamic SQL and Oracle stored procedures

    Does anybody has any experience with invoking an Oracle stored procedures
    with output parameters, using dynamic SQL from Forte?
    Thanks,
    Dimitar

    I would be interested. We are currently using a homegrown DataMapper architecture with the Microsoft OracleClient. I would like to move to ODP.Net once a production version supporting ADO.Net 2.0 is available. After that, I would then like to look at using an off the shelf persistence framework such as EntitySpaces, NHibernate or IdeaBlade's DevForce.

  • Passing Dynamic Values to a Stored Procedure

    I have a stored procedure to create a Table. How to I pass a
    value to the procedure to name the Table. This SP works except the
    name of the table is @newcomm not the value I am trying to pass in.
    What is the proper syntax to make this happen.
    CREATE PROCEDURE [dbo].[sp_newcommenttbl]
    @newcomm varchar (50)
    AS
    BEGIN
    CREATE TABLE [dbo].[@newcomm] (
    [configid] [int] IDENTITY (1, 1) NOT NULL ,
    [email] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL ,
    [adminemail] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [erroremail] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [toCommentFormEmail] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dsn] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL ,
    [gmdsn] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL ,
    [dbusername] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbpassword] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [acfcpath] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [acfcpath2] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [acfcpath3] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [urlactivate] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [urlresetpassword] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [initialized] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename1] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename2] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename3] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename4] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename5] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename6] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename7] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename8] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename9] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename10] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [pageheader] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL
    ) ON [PRIMARY]
    END
    GO
    <cfstoredproc procedure="sp_newcommenttbl"
    datasource="xxxxx" returncode="no">
    <cfprocparam type="in" maxlength="50"
    cfsqltype="cf_sql_varchar" value="pighg3">
    </cfstoredproc>

    When I create the procedure I don't get an error. I get an
    error when I call it.
    [Macromedia][SQLServer JDBC Driver][SQLServer]Incorrect
    syntax near the keyword 'ON'.
    ColdFusion cannot determine the line of the template that
    caused this error. This is often caused by an error in the
    exception handling subsystem.
    Here is the call.
    <cfstoredproc procedure="sp_newcommenttbl"
    datasource="pisecurity" returncode="no">
    <cfprocparam type="in" maxlength="50"
    cfsqltype="cf_sql_varchar" value="pighg3" variable="newcomm">
    </cfstoredproc>
    Here is the syntax for the SP.
    CREATE PROCEDURE [dbo].[sp_newcommenttbl]
    @newcomm varchar (50)
    AS
    BEGIN
    EXEC('CREATE TABLE [dbo].['+@newcomm+'] (
    [configid] [int] IDENTITY (1, 1) NOT NULL ,
    [email] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL ,
    [adminemail] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [erroremail] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [toCommentFormEmail] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dsn] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL ,
    [gmdsn] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL ,
    [dbusername] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbpassword] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [acfcpath] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [acfcpath2] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [acfcpath3] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [urlactivate] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [urlresetpassword] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [initialized] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename1] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename2] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename3] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename4] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename5] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename6] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename7] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename8] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename9] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename10] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [pageheader] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL
    ON [PRIMARY]')
    END
    GO

  • Help Needed in Creating Java Class and Java Stored Procedures

    Hi,
    Can anyone tell how can i create Java Class, Java Source and Java Resource in Oracle Database.
    I have seen the Documents. But i couldn't able to understand it correctly.
    I will be helpful when i get some Examples for creating a Java Class, Java Source and Stored Procedures with Java with details.
    Is that possible to Create a Java class in the oracle Database itself ?.
    Where are the files located for the existing Java Class ?..
    Help Needed Please.
    Thanks,
    Murali.v

    Hi Murali,
    Heres a thread which discussed uploading java source file instead of runnable code on to the database, which might be helpful :
    Configure deployment to a database to upload the java file instead of class
    The files for the java class you created in JDev project is located in the myworks folder in jdev, eg, <jdev_home>\jdev\mywork\Application1\Project1\src\project1
    Hope this helps,
    Sunil..

Maybe you are looking for

  • How to add 16 bit message sequential number to the byte array

    hi iam trying to implement socket programming over UDP. Iam writing for the server side now.I need to send an image file from server to a client via a gateway so basically ive to do hand-shaking with the gateway first and then ive to send image data

  • How do I reinstall Adobe Photoshop CS4 - I receive error 6 stating that licensing for this product has stopped working.

    I previously installed Adobe Photoshop CS4 on my Macbook Pro. My hard drive crashed, and I had to get a new hard drive replaced. Now upon trying to reinstall CS4 from a backup copy CD (with licensing, serial number available), I receive an error 6 st

  • Is this spam or legit?

    Please see the screen shot below of an email I received. The email address is [email protected] Looks like SPAM, especially since it did not go to the primary email address on the account.

  • FND_VIEWOBJECT_NOT_FOUND

    I am trying to make a stand alone region that I can embed into custom or seeded pages. This particular region does an employee search, though I will be dding more functionality after I get the basic version working properly. I made a test page and ex

  • Files to download

    HI Guys, Can you tell me what files do i need to select  from service.sap.com/swdc. when i need to download netweaver 7.0 of ECC 6.0. from download . Regd's Vallaba