Executing ddl

i am trying to create a schema in OCI for oracle which consiste of multiple DDL statements like create table, create view and create index (Each type nearly 10 statements)
i tried through OCIStmtExecute() and OCIStmtPrepare(). but they are accepting only one DDL statament at a time. i want to create all schema at once. i tried with create schema statement. it is accepting only create table and create view in it. is there any mechanism or call by which i can create all my schema at once (all tables,views and indexes) by one statement.

No, scripting of SQL is something the interface does (like SQL*Plus) and not the API.

Similar Messages

  • View for Last executed DDL ?

    Hi,
    Is thr any view to find out the last executed ddl ?
    Because i need to know last change happend in the database .
    Thanking You
    Jeneesh

    From asktom :
    Tom,
    Can I have my last executed SQL retrieved from the database?
    just by passing the sid. I want those SQL executed in my application not the onse executed by
    Oracle itself
    Followup   November 12, 2003 - 5pm US/Eastern:
    you'll get the last sql executed by joining v$session to v$sql. if the last sql executed was
    recursive SYS sql -- you'll get that (that would be the last sql).  we really don't discriminate
    between them
        Forgot to tell you this data dictionary view will age out. So there is no absolute guarantee you will find all the sql executed since the database instance has been started. Other option is Audit. For more information refer oracle manual.
    Regards
    Ra
    Message was edited by:
    s.rajaram

  • Getting an error while executing ddl commands using dblink

    Hi,
    i am using Oracle9iR2 Version.
    i have created a procedure like below to execute ddl commands on remote database through dblink using dbms_sql.
    CREATE OR REPLACE PROCEDURE run_remote_ddl (p_dblink VARCHAR2, qry VARCHAR2)
    AS
    c_handle NUMBER;
    feedback INTEGER;
    stat VARCHAR2 (2000);
    BEGIN
    stat := 'select DBMS_SQL.open_cursor' || p_dblink || ' from dual';
    EXECUTE IMMEDIATE stat
    INTO c_handle;
    stat :=
    'begin DBMS_SQL.parse'
    || p_dblink
    || ' ('
    || c_handle
    || ','''
    || qry
    || ''', DBMS_SQL.v7); end;';
    EXECUTE IMMEDIATE stat;
    stat :=
    ' select DBMS_SQL.EXECUTE' || p_dblink || '(' || c_handle
    || ') from dual';
    EXECUTE IMMEDIATE stat
    INTO feedback;
    stat :=
    'declare x integer; begin x:= :1; DBMS_SQL.close_cursor'
    || p_dblink
    || '(x); end;';
    EXECUTE IMMEDIATE stat
    USING c_handle;
    END;
    when i run this procedure like below
    begin
    run_remote_ddl ('@dblink', 'create table scott.ttt(num number)');
    end;
    got an error:
    ORA-06553: PLS-103: Encountered the symbol ".2" when expecting one of the following:
    . ( * @ & = - + ; < / > at in is mod not rem
    <an exponent (**)> <> or != or ~= >= <= <> and or like
    between ||
    The symbol ". was inserted before ".2" to continue.
    ORA-06512: at RUN_REMOTE_DDL", line 9
    ORA-06512: at line 2
    Please tell me how to resolve this.
    Thanks in advance.

    Hi,
    >
    ORA-06553: PLS-103: Encountered the symbol ".2" when expecting one of the following:
    . ( * @ & = - + ; < / > at in is mod not rem
    <an exponent (**)> or != or ~= >= <= <> and or like
    between
    >
    Hope you are not typing 2 instead of @ as both are on the same key
    Can you run the following and see what is happening
    CREATE OR REPLACE PROCEDURE run_remote_ddl (p_dblink VARCHAR2, qry VARCHAR2)
    AS
    c_handle NUMBER;
    feedback INTEGER;
    stat VARCHAR2 (2000);
    BEGIN
    dbms_output.put_line(p_dblink);
    stat := 'select DBMS_SQL.open_cursor@dblink from dual';
    --stat := 'select DBMS_SQL.open_cursor from dual';
    EXECUTE IMMEDIATE stat
    INTO c_handle;
    END;
    exec run_remote_ddl('@dblink', 'create table scott.ttt(num number)');Regards
    Edited by: yoonus on Feb 20, 2013 3:47 AM

  • Analysis Services Execute DDL Task Internal error

    Hi all,
    I need help in solving this sporadic problem...  the dimension below (blanked out as xxxx) is based on a view.  The cube processes fine many times - but fails - abruptly once a week... it's being called from a sql job.
    Any ideas?  Thanks in advance!!
    Error: 2010-06-28 15:45:17.69     Code: 0xC1000007     Source: xxxxxxx Analysis Services Execute DDL Task     Description: Internal error: The operation terminated unsuccessfully.  End Error 
    Error: 2010-06-28 15:45:17.69     Code: 0xC11F000D     Source: xxxxxxx Analysis Services Execute DDL Task     Description: Errors in the OLAP storage engine: An error occurred while the 'xxxxx' attribute
    of the 'xxxxx' dimension from the 'xxxxxx' database was being processed.  End Error  Error: 2010-06-28 15:45:17.69     Code: 0xC11F0006     Source: xxxxxxx Analysis Services Execute DDL Task    
    Description: Errors in the OLAP storage engine: The process operation ended because the number of errors encountered during processing reached the defined limit of allowable errors for the operation.  End Error  Error: 2010-06-28 15:45:17.69    
    Code: 0xC11C0002     Source: xxxxxx Analysis Services Execute DDL Task     Description: Server: The operation has been cancelled.  End Error  DTExec: The package execution returned DTSER_FAILURE (1). 
    Started:  3:45:00 PM  Finished: 3:45:17 PM  Elapsed:  17.328 seconds.  The package execution failed.  The step failed.
    Harsh B

    (From http://msdn.microsoft.com/en-us/library/cc966526.aspx)
    "ExternalCommandTimeout is a server property that is used to set the number of seconds that SSAS should wait to time out when issuing commands to external data sources, such as relational and other OLAP sources."
    "ExternalConnectionTimeout is a server property that is used to set the number of seconds, by default, that SSAS should wait to time out when connecting to external data sources, such as relational and other OLAP sources."
    What you set it to, it's absolutely up to you... But as I see it in your log, your task failed in 17 and 9 seconds... So I think you can multiply the values by 10, I guess the situation won't change... But it is worth to check it at least.
    So... How often your fact table gets new (degenerate) dimension reference values? Is it a process update, or a process full command? I really would like to see it :)
    -- Zoltán Horváth
    -- MCITP SQL Server Business Intelligence Developer 2005, 2008
    -- Please mark posts as answered or helpful where appropriate.

  • Analysis Service Execute DDL Task throwing error with SourceType Variable

    Hi,
    I have Configuring Analysis Services Execute DDL Task to use Variable and Process Data(xmla Script) like below:
    When I execute this task I get the below error message:
    [Analysis Services Execute DDL Task] Error: The -->
    text node at line 23, column 3 cannot appear inside the DataSource element (namespace http://schemas.microsoft.com/analysisservices/2003/engine) under Envelope/Body/Execute/Command/Batch/Parallel/Process. This element can
    only have text nodes containing white-space characters.
    Can anyone please let me know how to resolve this.

    If I run using the sourceType "Direct Input", the Analysis Execute DDL Task runs fine, but if I use the sourcetype as variable its throws the error. And below is the xmla script
    Here is my Package look and the xmla script; its failing at "ProcessAdd" Analysis Execute DDL task:
    "SELECT '<Batch xmlns=\"http://schemas.microsoft.com/analysisservices/2003/engine\">
    <ErrorConfiguration xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:ddl2=\"http://schemas.microsoft.com/analysisservices/2003/engine/2\" xmlns:ddl2_2=\"http://schemas.microsoft.com/analysisservices/2003/engine/2/2\" xmlns:ddl100_100=\"http://schemas.microsoft.com/analysisservices/2008/engine/100/100\" xmlns:ddl200=\"http://schemas.microsoft.com/analysisservices/2010/engine/200\" xmlns:ddl200_200=\"http://schemas.microsoft.com/analysisservices/2010/engine/200/200\" xmlns:ddl300=\"http://schemas.microsoft.com/analysisservices/2011/engine/300\" xmlns:ddl300_300=\"http://schemas.microsoft.com/analysisservices/2011/engine/300/300\" xmlns:ddl400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400\" xmlns:ddl400_400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400/400\">
    <KeyNotFound>IgnoreError</KeyNotFound>
    </ErrorConfiguration>
    <Parallel>
    <Process xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:ddl2=\"http://schemas.microsoft.com/analysisservices/2003/engine/2\" xmlns:ddl2_2=\"http://schemas.microsoft.com/analysisservices/2003/engine/2/2\" xmlns:ddl100_100=\"http://schemas.microsoft.com/analysisservices/2008/engine/100/100\" xmlns:ddl200=\"http://schemas.microsoft.com/analysisservices/2010/engine/200\" xmlns:ddl200_200=\"http://schemas.microsoft.com/analysisservices/2010/engine/200/200\" xmlns:ddl300=\"http://schemas.microsoft.com/analysisservices/2011/engine/300\" xmlns:ddl300_300=\"http://schemas.microsoft.com/analysisservices/2011/engine/300/300\" xmlns:ddl400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400\" xmlns:ddl400_400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400/400\">
    <Object>
    <DatabaseID>IIS_Version2</DatabaseID>
    <DimensionID>Application</DimensionID>
    </Object>
    <Type>ProcessAdd</Type>
    <DataSource xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:ddl2=\"http://schemas.microsoft.com/analysisservices/2003/engine/2\" xmlns:ddl2_2=\"http://schemas.microsoft.com/analysisservices/2003/engine/2/2\" xmlns:ddl100_100=\"http://schemas.microsoft.com/analysisservices/2008/engine/100/100\" xmlns:ddl200=\"http://schemas.microsoft.com/analysisservices/2010/engine/200\" xmlns:ddl200_200=\"http://schemas.microsoft.com/analysisservices/2010/engine/200/200\" xmlns:ddl300=\"http://schemas.microsoft.com/analysisservices/2011/engine/300\" xmlns:ddl300_300=\"http://schemas.microsoft.com/analysisservices/2011/engine/300/300\" xmlns:ddl400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400\" xmlns:ddl400_400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400/400\" xmlns:dwd=\"http://schemas.microsoft.com/DataWarehouse/Designer/1.0\" xsi:type=\"RelationalDataSource\" dwd:design-time-name=\"1a3cb292-9bce-4c59-a182-177d6b3506ff\" xmlns=\"http://schemas.microsoft.com/analysisservices/2003/engine\">
    <ID>IISDW</ID>
    <Name>IISDW</Name>
    <ConnectionString>Provider=SQLNCLI11.1;Data Source=CO1MSFTSQLHKT02;Integrated Security=SSPI;Initial Catalog=IISDW</ConnectionString>
    <Timeout>PT0S</Timeout>-->
    </DataSource>
    <DataSourceView xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:ddl2=\"http://schemas.microsoft.com/analysisservices/2003/engine/2\" xmlns:ddl2_2=\"http://schemas.microsoft.com/analysisservices/2003/engine/2/2\" xmlns:ddl100_100=\"http://schemas.microsoft.com/analysisservices/2008/engine/100/100\" xmlns:ddl200=\"http://schemas.microsoft.com/analysisservices/2010/engine/200\" xmlns:ddl200_200=\"http://schemas.microsoft.com/analysisservices/2010/engine/200/200\" xmlns:ddl300=\"http://schemas.microsoft.com/analysisservices/2011/engine/300\" xmlns:ddl300_300=\"http://schemas.microsoft.com/analysisservices/2011/engine/300/300\" xmlns:ddl400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400\" xmlns:ddl400_400=\"http://schemas.microsoft.com/analysisservices/2012/engine/400/400\" xmlns:dwd=\"http://schemas.microsoft.com/DataWarehouse/Designer/1.0\" dwd:design-time-name=\"b0b61205-c64d-4e34-afae-6d4d48b93fb3\" xmlns=\"http://schemas.microsoft.com/analysisservices/2003/engine\">
    <ID>IISDW</ID>
    <Name>IISDW</Name>
    <DataSourceID>IISDW</DataSourceID>
    <Schema>
    <xs:schema id=\"IISDW_x0020_1\" xmlns=\"\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\" xmlns:msprop=\"urn:schemas-microsoft-com:xml-msprop\">
    <xs:element name=\"IISDW_x0020_1\" msdata:IsDataSet=\"true\" msdata:UseCurrentLocale=\"true\" msprop:design-time-name=\"72037318-e316-469d-9a45-a10c77709b39\">
    <xs:complexType>
    <xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">
    <xs:element name=\"Application\" msprop:design-time-name=\"7f579e7e-e8b7-4a9d-8a93-a255fccbbfbe\" msprop:IsLogical=\"True\" msprop:FriendlyName=\"Application\" msprop:DbTableName=\"Application\" msprop:TableType=\"View\" msprop:Description=\"\" msprop:QueryDefinition=\"SELECT a.Application, DATEADD([hour], DATEDIFF([hour], 0, a.[Timestamp]), 0) AS [Timestamp], a.ServerName, CAST(a.ServerName AS char(3)) AS DataCenter, a.CS_URI_Stem, CAST(HashBytes(''MD5'', &#xD;&#xA; a.Application + a.ServerName + a.CS_URI_Stem + CAST(DATEADD([hour], DATEDIFF([hour], 0, a.[Timestamp]), 0) AS varchar(24))) AS uniqueidentifier) AS Server_URI_Identity&#xD;&#xA;FROM IIS_6_OLD AS a LEFT OUTER JOIN&#xD;&#xA; Dimension_Pointer AS b ON a.Application = b.Application&#xD;&#xA;WHERE (b.ProcessedFlag = 0) AND (a.Application IN ("+(DT_WSTR,100) @[User::strDistinctApplication]+"))&#xD;&#xA;GROUP BY a.Application, DATEADD([hour], DATEDIFF([hour], 0, a.[Timestamp]), 0), a.ServerName, a.CS_URI_Stem\" msprop:QueryBuilder=\"SpecificQueryBuilder\">
    <xs:complexType>
    <xs:sequence>
    <xs:element name=\"Application\" msprop:design-time-name=\"f3074e98-4a82-4bc5-a818-916203f7758b\" msprop:DbColumnName=\"Application\" msprop:FriendlyName=\"Application\" minOccurs=\"0\">
    <xs:simpleType>
    <xs:restriction base=\"xs:string\">
    <xs:maxLength value=\"255\" />
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name=\"Timestamp\" msdata:ReadOnly=\"true\" msprop:design-time-name=\"2662e3a8-8b1a-4d77-aecb-575329b84dc1\" msprop:DbColumnName=\"Timestamp\" msprop:FriendlyName=\"Timestamp\" type=\"xs:dateTime\" />
    <xs:element name=\"ServerName\" msprop:design-time-name=\"ced26d49-cd6e-4073-a40c-ff5ef70e4ef1\" msprop:DbColumnName=\"ServerName\" msprop:FriendlyName=\"ServerName\" minOccurs=\"0\">
    <xs:simpleType>
    <xs:restriction base=\"xs:string\">
    <xs:maxLength value=\"255\" />
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name=\"DataCenter\" msdata:ReadOnly=\"true\" msprop:design-time-name=\"4583e15a-dcf1-45a2-a30b-bd142ca8b778\" msprop:DbColumnName=\"DataCenter\" msprop:FriendlyName=\"DataCenter\" minOccurs=\"0\">
    <xs:simpleType>
    <xs:restriction base=\"xs:string\">
    <xs:maxLength value=\"3\" />
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name=\"CS_URI_Stem\" msprop:design-time-name=\"10db5a79-8d50-49d2-9376-a3b4d19864b9\" msprop:DbColumnName=\"CS_URI_Stem\" msprop:FriendlyName=\"CS_URI_Stem\" minOccurs=\"0\">
    <xs:simpleType>
    <xs:restriction base=\"xs:string\">
    <xs:maxLength value=\"4000\" />
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name=\"Server_URI_Identity\" msdata:DataType=\"System.Guid, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\" msdata:ReadOnly=\"true\" msprop:design-time-name=\"018ede0a-e15e-47c2-851b-f4431e8c839c\" msprop:DbColumnName=\"Server_URI_Identity\" msprop:FriendlyName=\"Server_URI_Identity\" type=\"xs:string\" />
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:choice>
    </xs:complexType>
    <xs:unique name=\"Constraint1\" msprop:IsLogical=\"True\" msdata:PrimaryKey=\"true\">
    <xs:selector xpath=\".//Application\" />
    <xs:field xpath=\"Server_URI_Identity\" />
    <xs:field xpath=\"Timestamp\" />
    </xs:unique>
    </xs:element>
    </xs:schema>
    <IISDW_x0020_1 xmlns=\"\" />
    </Schema>
    </DataSourceView>
    <WriteBackTableCreation>UseExisting</WriteBackTableCreation>
    </Process>
    </Parallel>
    </Batch>' as XMLAScript_ProcessData"

  • Executing ddl statment in pl/sql block

    Hi all,
    could anyone pls help in method for executing ddl statment in pl/sql block other than 'execute immediate' ?

    could anyone pls help in method for executing ddl statment in pl/sql block other than 'execute immediate' ?On newer db versions you have more options:
    SQL> desc t
    Error: object t does not exist
    SQL> exec sys.dbms_prvtaqim.execute_stmt('create table michael.t (a integer)')
    PL/SQL procedure successfully completed.
    SQL> desc t
    TABLE t
    Name                                      Null?    Type                       
    A                                                  NUMBER                     
    SQL> exec sys.dbms_utility.exec_ddl_statement('drop table michael.t')
    PL/SQL procedure successfully completed.
    SQL> desc t
    Error: object t does not exist;)

  • Analysis Services execute ddl task

    Hi,
    I want to run the Analysis Services execute ddl task to execute a cube creation via xmla script.
    The cube could already exist, so I want to ask if it exists before running the task or else it will fail.
    What would be the best way to perform this - if exist question ?
    Dani

    You can use alter element like this example:
    <Alter ObjectExpansion="ObjectProperties" xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
    <Object>
    <DatabaseID>Adventure Works DW Multidimensional 2012</DatabaseID>
    <DataSourceID>AdventureWorksDW2012</DataSourceID>
    </Object>
    <ObjectDefinition>
    <DataSource xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="RelationalDataSource">
    <ID>AdventureWorksDW2012</ID>
    <Name>AdventureWorksDW2012</Name>
    <ConnectionString>Data Source=fr-dwk-02;Initial Catalog=AdventureWorksDW2008R2;Integrated Security=True</ConnectionString>
    <ManagedProvider>System.Data.SqlClient</ManagedProvider>
    <Timeout>PT30S</Timeout>
    </DataSource>
    </ObjectDefinition>
    </Alter>
    More info on "Alter Element" on MSDN 
    http://technet.microsoft.com/en-us/library/ms186630.aspx

  • Why there is implicit commit before and after executing DDL Statements

    Hi Guys,
    Please let me know why there is implicit commit before and after executing DDL Statements ?
    Regards,
    sushmita

    Helyos wrote:
    This is because Oracle has design it like this.Come on Helyos, that's a bit of a weak answer. :)
    The reason is that it makes no sense to update the structure of the database whilst there is outstanding data updates that have not been committed.
    Imagine having a column that is VARCHAR2(50) that currently only has data that is up to 20 characters in size.
    Someone (person A) decides that it would make sense to alter the table and reduce the size of the column to varchar2(20) instead.
    Before they do that, someone else (person B) has inserted data that is 30 characters in size, but not yet committed it.
    As far as person B is concerned that insert statement has been successful as they received no error, and they are continuing on with their process until they reach a suitable point to commit.
    Person A then attempts to alter the database to make it varchar2(20).
    If the database allowed that to happen then the column would be varchar2(20) and the uncommitted data would no longer fit, even though the insert was successful. When is Person B going to find out about this? It would be wrong to tell them when they try and commit, because all their transactions were successful, so why should a commit fail.
    In this case, because it's two different people, then the database will recognise there is uncommitted transactions on that table and not let person B alter it.
    If it was just one person doing both things in the same session, then the data would be automatically committed, the alter statement executed and the person informed that they can't alter the database because there is (now) data exceeding the size they want to set it to.
    It makes perfect sense to have the database in a data consistent state before any alterations are made to it, hence why a commit is issued beforehand.
    Here's something I wrote the other day on the subject...
    DDL's issue a commit before carrying out the actual action
    As long as the DDL is syntactically ok (i.e. the parser is happy with it) then the commit is issued, even if the actual DDL cannot be executed for another reason.
    Example...
    We have a table with some data in it...
    SQL> create table xtest as select rownum rn from dual;
    Table created.
    SQL> select * from xtest;
            RN
             1We then delete the data but don't commit (demonstrated by the fact we can roll it back)
    SQL> delete from xtest;
    1 row deleted.
    SQL> select * from xtest;
    no rows selected
    SQL> rollback;
    Rollback complete.
    SQL> select * from xtest;
            RN
             1
    SQL> delete from xtest;
    1 row deleted.
    SQL> select * from xtest;
    no rows selectedSo now our data is deleted, but not committed, what if we issue a DDL that is syntactically incorrect...
    SQL> alter tab xtest blah;
    alter tab xtest blah
    ERROR at line 1:
    ORA-00940: invalid ALTER command
    SQL> rollback;
    Rollback complete.
    SQL> select * from xtest;
            RN
             1... the data can still be rolled back. This is because the parser was not happy with the syntax of the DDL statement.
    So let's delete the data again, without committing it, and issue a DDL that is syntactically correct, but cannot execute for another reason (i.e. the database object it refers to doesn't exist)...
    SQL> delete from xtest;
    1 row deleted.
    SQL> select * from xtest;
    no rows selected
    SQL> truncate table bob;
    truncate table bob
    ERROR at line 1:
    ORA-00942: table or view does not exist
    SQL> rollback;
    Rollback complete.
    SQL> select * from xtest;
    no rows selectedSo, there we have it. Just because the statement was syntactically correct, the deletion of the data was committed, even though the DDL couldn't be performed.
    This makes sense really, because if we are planning on altering the definition of the database where the data is stored, it can only really take place if the database is in a state where the data is where it should be rather than being in limbo. For example, imagine the confusion if you updated some data on a column and then altered that columns datatype to be a different size e.g. reducing a varchar2 column from 50 character down to 20 characters. If you had data that you'd just updated to larger than 20 characters whereas previously there wasn't, then the alter table command would not know about it, would alter the column size and then the data wouldn't be valid to fit whereas the update statement at the time didn't fail.
    Example...
    We have a table that only allows 20 characters in a column. If we try and insert more into that column we get an error for our insert statement as expected...
    SQL> create table xtest (x varchar2(20));
    Table created.
    SQL> insert into xtest values ('012345678901234567890123456789');
    insert into xtest values ('012345678901234567890123456789')
    ERROR at line 1:
    ORA-12899: value too large for column "SCOTT"."XTEST"."X" (actual: 30, maximum: 20)Now if our table allowed more characters our insert statement is successful. As far as our "application" goes we believe, nay, we have been told by the database, we have successfully inserted our data...
    SQL> alter table xtest modify (x varchar2(50));
    Table altered.
    SQL> insert into xtest values ('012345678901234567890123456789');
    1 row created.Now if we tried to alter our database column back to 20 characters and it didn't automatically commit the data beforehand then it would be happy to alter the column, but then when the data was committed it wouldn't fit. However the database has already told us that the data was inserted, so it can't go back on that now.
    Instead we can see that the data is committed first because the alter command returns an error telling us that the data in the table is too big, and also we cannot rollback the insert after the attempted alter statement...
    SQL> alter table xtest modify (x varchar2(20));
    alter table xtest modify (x varchar2(20))
    ERROR at line 1:
    ORA-01441: cannot decrease column length because some value is too big
    SQL> rollback;
    Rollback complete.
    SQL> select * from xtest;
    X
    012345678901234567890123456789
    SQL>Obviously, because a commit statement is for the existing session, if we had tried to alter the table column from another session we would have got
    SQL> alter table xtest modify (x varchar2(20));
    alter table xtest modify (x varchar2(20))
    ERROR at line 1:
    ORA-00054: resource busy and acquire with NOWAIT specified
    SQL>... which is basically saying that we can't alter the table because someone else is using it and they haven't committed their data yet.
    Once the other session has committed the data we get the expected error...
    ORA-01441: cannot decrease column length because some value is too bigHope that explains it

  • Use of JDBC to execute ddls in oracle database

    Hi,
    I am knew to the JDBC concepts. My requirement is to execute oracle database ddls from a JSP application. The ddls like 'Alter tablespace...', 'Alter session...' etc.. The application is using JDBC to connect to the database.
    Is there any option available to do this task using JDBC
    If not, then please let me know if there are any other ways to execute such statements from an application.
    Thanks

    shah wrote:
    Is there any option available to do this task using JDBC1. Find PL/SQL code that does this in a stored proc
    2. Run the stored proc from jdbc.
    If you can't do it in a proc then you can't do it from jdbc.
    If not, then please let me know if there are any other ways to execute such statements from an application.You can run scripts via the command line using sqlplus (character mode.)
    Sqlplus is an application.
    You can control any application (character based) in java via Runtime.exec/ProcessBuilder.

  • Errors when executing DDL statements against MaxDB

    Hi guys,
    We are experiencing problems with DDL execution against MaxDB. I have installed version 7.8.00.17 on my 32-bit Windows XP XP3 machine. I got the following errors:
    1. MaxDB complained that the "VARCHAR(8008)" data type has invalid length.
    2. When fixing this, I got the problem, that a unique constraint has too long name.
    3. After shortening this name, now I get the following:
      u2190[4;35;1mSQL (0.0ms)u2190[0m   u2190[0mActiveRecord::JDBCError: SAP DBTech JDBC: [-4006] (at 25): Unknown domain name:PRIMARY_KEY: CREATE TABLE photos (id primary_key, title varchar(8008), created_at timestamp, updated_at timestamp) u2190[0m
    rake aborted!
    All these DDL statements, are generated as part of a rake task execution (we are testing a simple Rails application, that uses persistence), and they execute fine on MySQL for instance. But on MaxDB it seems that there are more severe limitations about name lengths, data types, etc.
    Could you please advice about this problem ?
    Thanks and Kindest Regards,
    Krum.

    Hmm... what's wrong with the internet on your side, that you don't have access to the MaxDB documentation?
    ad 1. You are using a UNICODE varchar, aren't you? check [here|http://maxdb.sap.com/doc/7_7/45/33337d9faf2b34e10000000a1553f7/frameset.htm] why it fails.
    ad 2. Unique constraints don't get names in MaxDB [see here|http://maxdb.sap.com/doc/7_7/45/50fa4272c31796e10000000a1553f6/frameset.htm]
    ad 3. You're simply using the wrong DDL format. "PRIMARY_KEY" is not even a MaxDB keyword.
    I'm pretty sure you'll find the correct syntax for primary key definition yourself, by simply browsing the documentation, so I leave this to you now.
    regards,
    Lars

  • Execute DDL statements from pl / sql

    Hi !!!!
    I have to create every object (tables, sequences, etc) using a pl / sql block, so I need first looking for the object in the data dictionary and if it doesn't exist execute a ddl statement to create it.
    I wanted to execute at the same "execute immediate " :
    - create table.
    - create synonym for the table created before.
    - comments on table
    - comments on table's columns
    - grants on the table.
    But I found some errors:
    - I can`t have semicolon after every statement so I get an "ORA-00911: invalid character". I did'nt try to scape the semicolon so I need it.
    - I split the execute immediate so now I have one execute immediate for every statement but I got an error in this statement:
    EXECUTE IMMEDIATE 'COMMENT ON TABLE SYSADM.CVP_PAQ_SMS_REC_PRUEBA IS "COMMENT ON TABLE"  '; The error I get is this:
    ORA-01780: string literal required
    Any suggestions about this ?
    Thanks.

    The comment itself needs to be a SQL string so it needs to be delimited with single quotes not double quotes. You can either use two single quotes
    EXECUTE IMMEDIATE 'COMMENT ON TABLE SYSADM.CVP_PAQ_SMS_REC_PRUEBA IS ''COMMENT ON TABLE''  ';or you can use the q quoting syntax
    EXECUTE IMMEDIATE q'[COMMENT ON TABLE SYSADM.CVP_PAQ_SMS_REC_PRUEBA IS 'COMMENT ON TABLE'  ]';You cannot combine multiple DDL statements into a single block (well, you could use dynamic PL/SQL, but then your string would have a bunch of embedded EXECUTE IMMEDIATE statements which would presumably not buy you much).
    Justin

  • Execute DDL Commands inside a transactionScope

    Hi,
    I know that in Oracle all DDL commands include an implicit COMMIT so when you use one of them inside a transactionScope an exception is thrown due to this internal COMMIT. I’m receiving following exception ORA-02089: COMMIT is not allowed in a subordinate session. Is there any way to avoid this limitation?
    Thanks in advance,
    Francesc

    Hi,
    There's no way to get DDL to not autocommit.
    What you could do though is use a stored procedure to do the ddl, and declare the procedure with PRAGMA AUTONOMOUS_TRANSACTION.
    I'm not sure what the advisability of that is since anything that that occurs in the procedure wont be rolled back as part of the transaction, but it works anyway.
    Cheers,
    Greg
    create or replace procedure ExecOutsideTxn(strsql in varchar2) as
    pragma autonomous_transaction;
    begin
    execute immediate strsql;
    end;
    using System;
    using Oracle.DataAccess.Client;
    using System.Transactions;
    using System.Data;
    class Program
    static void Main(string[] args)
    using (TransactionScope ts = new TransactionScope(TransactionScopeOption.RequiresNew))
    using (OracleConnection con = new OracleConnection())
    con.ConnectionString = "user id=scott;password=tiger;data source=orcl";
    con.Open();
    using (OracleCommand cmd = new OracleCommand())
    cmd.CommandText = "begin ExecOutsideTxn('create table foo (col1 varchar2(10))');end;";
    cmd.Connection = con;
    cmd.ExecuteNonQuery();
    // do some other stuff
    ts.Complete();
    }

  • Executing DDL over a DB Link

    Hi there gurus...
    Version: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit
    As a test of something I wish to do, I'm submitting the following CREATE TABLE DDL statement as a job from within a schema over a dblink:
    declare
    v number;
    begin
    dbms_job.submit@GL_UPDATE_DBA(v,'
    declare v varchar2(2000);
    begin
    execute immediate ''create table tempcb2 (x number)'';
    exception when others then v := SQLERRM; insert into tempcb1 (x) values (v); commit;
    raise;
    end;');
    commit;
    end;The DB Link GL_UPDATE_DBA connects to a remote DB instance using a schema called SUPPORT_DBA.
    When I run this code, the job is submitted fine within SUPPORT_DBA schema on the remote DB. However, an exception is captured and written to the table TEMPCB1 stating: ORA-01031: insufficient privileges.
    When I check the job details on the remote DB using
    SELECT * FROM USER_JOBSin the SUPPORT_DBA schema, the LOG_USER, PRIV_USER and SCHEMA_USER all list the proper value: SUPPORT_DBA.
    From the documentation description of PRIV_USER, this job should be running with the privileges of SUPPORT_DBA and therefore, to my feable mind at least(!), should be able to create a table within that schema.
    Why is the job unable to create a table in the SUPPORT_DBA schema?? Have I misinterpreted the way jobs (and their associated privs) work??
    Thanks in advance...

    Hi,
    Supposedly anonymous PL/SQL blocks run always with invoker's rights but if you're using a fixed-user db link it makes me wonder... fixed should be the fixed user nevertheless. I wish I had another instance to test this here properly.
    Anyways, I believe for it to work properly you will need to grant the relevant privileges to SUPPORT_DBA directly, NOT through roles.
    Users connect using the username and password referenced in the link. For example, if Jane uses a fixed user link that connects to the hq database with the username and password scott/tiger, then she connects as scott, Jane has all the privileges in hq granted to scott directly, and all the default roles that scott has been granted in the hq database.http://download.oracle.com/docs/cd/E11882_01/server.112/e10595/ds_concepts002.htm
    If it doesn't work regardless of the direct grants, could you post your create database link statement please (I don't wanna see the password :p )?

  • Execute DDL in a package

    I connected as system/manager and executed:
    CREATE OR REPLACE PROCEDURE create_user IS
    BEGIN
    EXECUTE IMMEDIATE 'create user my_user identified by my_user' ;
    END;
    But the following error displayed:
    ORA-01031: insufficient privileges
    How can we solve the problem?
    null

    If you got the error while compiling that means you don not have enough privilges to create procedures , if you got the error while running it means that you do not have the priv to create users.
    say
    SELECT * FROM SESSION_PRIVS; -- to have a look at the privs that you have .If you lack the above privs, please contact u're DBA to grant you the same.

  • SSAS cube sync between two servers using analysis service execute DDL task in SSIS

    hi folks:
      I have two AS servers: TOBIDW and TOBIDW2. TOBIDW2 is the production server where users use Excel to connect . TOBIDW has been identified as a backup Cube server in case if TOBIDW2 is not available.   My job is to create a SSIS package that syncs
    cube db from TOBIDW2 to TOBIDW everyday (one way).
       The standard SSIS dev process  for us   is to develop  in the dev environment and deploy  to production env.  The XMLA script has been extracted using Sync wizard of SSMS on production cube server.  Inside this
    XMLA, the connectionstring is using integrated security = SSPI. 
    When deploy to production, what username/password I should use to replace the integrated security? 
    Thanks
    <Synchronize xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
    <Source>
    <ConnectionString>Provider=MSOLAP.5;Data Source=TOBIDW2;Integrated Security=SSPI;Initial Catalog=ORDERDW</ConnectionString>
    <Object>
    <DatabaseID>ORDERDW</DatabaseID>
    </Object>
    </Source>
    <SynchronizeSecurity>CopyAll</SynchronizeSecurity>
    <ApplyCompression>true</ApplyCompression>
    </Synchronize>
    --Currently using Reporting Service 2000; Visual Studio .NET 2003; Visual Source Safe SSIS 2008 SSAS 2008, SVN --

    Hi cat_ca, 
    You don't need to replace Integrated Security=SSPI with other Windows username and password. Integrated Security means it uses the Windows user that launches the process (the dtexec.exe that runs your SSIS package) to connect to the server TOBIDW2 you defined
    in your connection string. 
    Actually for SSAS connection string, you don't normally need to specify user name and password because SSAS only takes Windows Authentication and Integrated Security takes care of it for us automatically using SSPI. The only case when you need to manually
    enter user name and password (Windows user) is when you configured a HTTP Pump to sit in front of your SSAS server and use HTTP://servername/ to access your SSAS server. This is because IIS server could be configured to take Basic Authentication which requires
    explicitly supply Windows user name and password for authentication. In that case your connection string should look similar to this:
    Provider=MSOLAP;Data Source=http://serverName/;Initial Catalog=myDataBase;
    User Id=domain\user;Password=myPassword;

Maybe you are looking for

  • My music sounds garbled - is not playing correctly

    This is my son's iPod and Im not sure what he has done to it, but the music sounds like it is being played under water. I have did the 5 R's and also wiped out all the music and reinstalled it and Im getting the same effect. It is not the ear buds ei

  • Inspection Char without Inspection lot generation

    Hi We are trying to model a customer requirement in PP for which a few production steps have a few characteristics to be monitored (status checked); for example - in a process of "spraying fertilizer", qty of 4 fertilizers have to be noted in the ope

  • Iphone 5 froze while using navigation?

    I was using the new maps app on my iphone 5 and when I lost service, the app froze then shut my phone down multiple times.  I heard of the app not being accurate but never heard anything like this happening.  Anyone else have this?

  • Do not open nothing here

    accidently posted two of the same thing

  • New camera support?

    I'm not sure if anyone here can answer this, will LR3 have support for the new Fuji X100 in the next update? Any ideas when the next update will ship if it will support it? Thanks!