Tables created via SQL...

There is a way to show information stored in a table creadted via SQL in the SBO Print Forms ?

Hello!
yes, this will work as such, but might not give you the
correct values as there is no link between the table and the layout! Usually, it pulls simply the first value in the table.
Or, you might be lucky that it works now, but not after an upgrade.
Be careful when adding field with "ALT", if you encounter problems at any stage, you will not receive any support!
When adding fields via "ALT", check if you can create manual links between the table and the layout via "next segment" and "link to".
Kind regards

Similar Messages

  • Internal PLSQL Tables Access via SQL. But how ?

    Hello,
    I want to write the result of a database query in an internal PLSQL Table. After that i would like work with this internal PLSQL Table
    in a Package/Procedure/Function.
    Important for me is to access the internal Table via SQL because i have to refactor a package wich is working with 46 Database Tables an plain SQL. I
    would like to change these DB Tables into internal PLSQL Tables.
    I have written a short example wich will explain my approach to solving this problem.
    The syntax will be accepted by the Database but my 'dbms_output.put_line' statement at the end is empty or blank.
    What do i wrong ? Would be nice if anyone can help me out.
    With best regards
    Jens
    pre work :
    create table PERSON_DB_TABLE
    (SURNAME  VARCHAR2(50),
    LASTNAME VARCHAR2(50));
    insert into PERSON_DB_TABLE values
    ('JENS','FOERSTER');
    insert into PERSON_DB_TABLE values
    ('MAX','MEIER');
    insert into PERSON_DB_TABLE values
    ('MARTHA','MUSTERMANN');
    create type PERSON_OBJECT as object (
        SURNAME  VARCHAR2(50),
        LASTNAME VARCHAR2(50));
    create type PERSON_NESTED_TABLE as table of PERSON_OBJECT;
    now my anonymous block
    declare
       v_PERSON_OBJECT        PERSON_OBJECT;
       v_PERSON_NESTED_TABLE  PERSON_NESTED_TABLE;
       v_PERSON_OBJECT_2      PERSON_OBJECT;
    begin
       for v_counter in (select SURNAME, LASTNAME into v_PERSON_OBJECT.SURNAME,
                                                                                            v_PERSON_OBJECT.LASTNAME
                                  from PERSON_DB_TABLE)
         loop
            v_PERSON_NESTED_TABLE := PERSON_NESTED_TABLE(v_PERSON_OBJECT);
         end loop;
       for v_counter in (select SURNAME, LASTNAME into v_PERSON_OBJECT_2.SURNAME,
                                                                                            v_PERSON_OBJECT_2.LASTNAME
                                  from TABLE (v_PERSON_NESTED_TABLE))
         loop
            dbms_output.put_line(v_PERSON_OBJECT_2.LASTNAME);
         end loop; 
    end;

    1386a7b8-e834-43bf-a0d4-922b548bb70b wrote:
    I need this, because my customer didn't like the idea to use Database Tables instead of Variables in the RAM. So he wants this procedure redesigned.
    As Mike says, keep this person away from your database.
    Customers should not be dictating how to implement technical solutions, they should be providing business and logical requirements.
    PL/SQL arrays/collections use expensive PGA memory, taking up valuable server resources.
    Copying data from the database to PGA memory to try and process it using PL/SQL is bad design.  SQL is designed specifically for data manipulation using database tables, so it's the ideal way to do process data... directly on database tables.

  • Unable to Query Table Created Via Load/Unload Utility

    I just created a table by doing a data load of an tab-delimited file via the Load/Upload Utility. The table was successfully created, and I can view it on the Object Browser, but I cannot do SQL queries on it, either via SQL*Plus or via the SQL Commands page. What's going on?

    I got no error message at all from Firefox when I did the data Load, so it took me
    a while to suspect that the browser compatibility was at fault.Moreover, you posted in your first post in this thread that you saw table in Object Browser!
    Sounds as APEX bug to me...

  • Issues with new tables created in SQL Modeler

    Hi,
    whenever I create new tables in SQL Modeler, and then on the Oracle DB using the generatedDDL , strange things happen:
    When synchronizing the model with the Database, some tables, even if already existing on the DB, appear as missing and the generated DDL still contains the "CREATE TABLE ..." statement
    When synchronizing the Database with the model, the new tables created on the DB appear twice, once with the correct name and the 2nd time with the original name and the suffix "v1".
    There seems to be no way to properly synchronize the model with the DB, apart from removing the tables from the model and re-import the definitions from the DB.
    What am I doing wrong ? It seems really strange to me that no one has ever reported a bug like this!
    Thank you

    Hi,
    whenever I create new tables in SQL Modeler, and then on the Oracle DB using the generatedDDL
    There seems to be no way to properly synchronize the model with the DB, apart from removing the tables from the model and re-import the definitions from the DB
    I'm able to reproduce your problem in case tables are imported into model using more than one connections. You need to use "Sync New Objects" in compare models dialog and then there will be no need to delete and import
    again tables from database. Unfortunately "Sync New Objects" functionality doesn't work in case objects are imported using more then one connections. I logged a bug for that.
    Philip

  • How to  insert  300 data from associative array to backend table in PL/SQL

    HI ALL,
    I'm posting my code here:
    Creating back end table:
    Create table orlando
    ( id number(20),
    calltype number(12),
         gateway_name varchar2(25),
         accounting_id varchar2(18),
         start_time_system_ticks number(11),
         node_time_zone      varchar2(25),
         start_date varchar2(10),     
         start_time varchar2(10),
         softswitch_response number(11),
         alerting number(11)     
    Creating package:
    CREATE OR REPLACE PACKAGE r IS
    type apollo_rec is record(
    id number(20),
    calltype number(12),
         gateway_name varchar2(25),
         accounting_id varchar2(18),
         start_time_system_ticks number(11),
         node_time_zone      varchar2(25),
         start_date varchar2(10),     
         start_time varchar2(10),
         softswitch_response number(11),
         alerting number(11)
    TYPE bin_array IS TABLE OF apollo_rec INDEX BY BINARY_INTEGER;
    PROCEDURE rr (state_array bin_array);
    END ;
    SET SERVEROUT ON
    CREATE OR REPLACE PACKAGE BODY r IS
    PROCEDURE rr (state_array bin_array) IS
    BEGIN
    FOR i IN 1 .. state_array.COUNT LOOP
    INSERT INTO orlando(id,calltype,gateway_name,accounting_id,start_time_system_ticks)VALUES(state_array(i).id,state_array(i).calltype,state_array(i).gateway_name,
    state_array(i).accounting_id,state_array(i).start_time_system_ticks);
    COMMIT;
    END LOOP;
    END ;
    END ;
    I've run this code in i*SQL PLUS.But when I run this code for 5 entries there is no error but when I modify the insert statement for 300 entries(300 identifiers in the insert statement)
    it gives me error:
    Warning: Package Body created with compilation errors.
    Errors for PACKAGE BODY R:
    LINE/COL      ERROR
    7/2      PL/SQL: SQL Statement ignored
    7/14      PL/SQL: ORA-00913: too many values
    Is there any feature in PL/SQL to decrease the entries in insert statement and make the insert statement along with the program small and increase the program performance.
    Edited by: 983040 on Jan 20, 2013 11:11 PM

    Basic example (ran on 11.2.0.3):
    SQL> create table testtab( id number, day date, val varchar2(30) );
    Table created.
    SQL>
    SQL> create or replace package TestTabLib as
      2 
      3          type TTestTab is table of testtab%rowtype;
      4 
      5          procedure InsertRows( rowArray TTestTab );
      6 
      7  end;
      8  /
    Package created.
    SQL>
    SQL> create or replace package body TestTabLib as
      2 
      3          procedure InsertRows( rowArray TTestTab ) is
      4          begin
      5                  forall i in 1..rowArray.Count
      6                          insert into testtab values rowArray(i);
      7          end;
      8 
      9  end;
    10  /
    Package body created.
    SQL>
    SQL> declare
      2          rowArray        TestTabLib.TTestTab;
      3  begin
      4          --// populating the array - using a bulk fetch as
      5          --// an example
      6          select
      7                  object_id, created, object_name
      8                          bulk collect into
      9                  rowArray
    10          from    all_objects
    11          where   rownum < 11;
    12 
    13          --// bulk insert array
    14          TestTabLib.InsertRows( rowArray );
    15  end;
    16  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> select * from testtab;
            ID DAY                 VAL
           100 2011/12/05 09:16:03 ORA$BASE
           116 2011/12/05 09:16:04 DUAL
           117 2011/12/05 09:16:04 DUAL
           280 2011/12/05 09:19:09 MAP_OBJECT
           365 2011/12/05 09:19:10 SYSTEM_PRIVILEGE_MAP
           367 2011/12/05 09:19:10 SYSTEM_PRIVILEGE_MAP
           368 2011/12/05 09:19:10 TABLE_PRIVILEGE_MAP
           370 2011/12/05 09:19:11 TABLE_PRIVILEGE_MAP
           371 2011/12/05 09:19:11 STMT_AUDIT_OPTION_MAP
           373 2011/12/05 09:19:11 STMT_AUDIT_OPTION_MAP
    10 rows selected.
    SQL>
    SQL> declare
      2          rowArray        TestTabLib.TTestTab;
      3  begin
      4          --// populating the array - using a custom build
      5          --// loop example such as a Java front-end will
      6          --// use reading data from user input form
      7          rowArray := new TestTabLib.TTestTab();
      8          rowArray.Extend(2);     --// user entered 2 values
      9          for i in 1..rowArray.Count loop
    10                  rowArray(i).id := i;
    11                  rowArray(i).day := trunc(sysdate);
    12                  rowArray(i).val := 'value '||to_char(i,'000');
    13          end loop;
    14 
    15          --// bulk insert array
    16          TestTabLib.InsertRows( rowArray );
    17  end;
    18  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> select * from testtab where val like 'value%';
            ID DAY                 VAL
             1 2013/01/21 00:00:00 value  001
             2 2013/01/21 00:00:00 value  002
    SQL>

  • How do i map one field to another in control file via SQL Loader

    Can someone please reply back to this question
    Hi,
    I have a flat file (student.dat delimiter %~| ) using control file (student.ctl) through sql loader. Here are the details.
    student.dat
    student_id, student_firstname, gender, student_lastName, student_newId
    101%~|abc%~|F %~|xyz%~|110%~|
    Corresponding table
    Student (
    Student_ID,
    Student_FN,
    Gender,
    Student_LN
    Question:
    How do i map student_newId field to student_id field in STUDENT DB table so that new id should be inserted in student_id column. How do i specify the mapping in control file. I dont want to create a new column in student table. Please let me know the best way to do this.
    Can someone please reply back to this question.
    My approach:
    In control file i will sepecify the below, Is this a best approach?. Do we have any othe way?
    STUDENT_ID *(:STUDENT_NEWID)*,
    STUDENT_FN,
    GENDER,
    STUDENT_LNAME,
    STUDENT_NEWID BOUNDFILLER
    Thanks
    Sunil
    Edited by: 993112 on Mar 13, 2013 12:28 AM
    Edited by: 993112 on Mar 13, 2013 12:30 AM
    Edited by: 993112 on Mar 13, 2013 12:31 AM
    Edited by: 993112 on Mar 18, 2013 2:52 AM

    OK, ok...
    Here is the sample data:
    101%~|abc%~|F %~|xyz%~|110%~|
    102%~|def%~|M %~|pqr%~|120%~|
    103%~|ghi%~|M %~|stu%~|130%~|
    104%~|jkl%~|F %~|vwx%~|140%~|
    105%~|mno%~|F %~|yza%~|150%~|Here is the control file:
    LOAD DATA
    INFILE student.dat
    TRUNCATE INTO TABLE STUDENT
    FIELDS TERMINATED BY '%~|' TRAILING NULLCOLS
      student_old  FILLER
    , student_fn
    , gender
    , student_ln
    , student_id
    )And here is the execution:
    SQL> CREATE TABLE student
      2  (
      3    student_id   NUMBER
      4  , student_fn   VARCHAR2 (10)
      5  , gender       VARCHAR2 (2)
      6  , student_ln   VARCHAR2 (10)
      7  );
    Table created.
    SQL>
    SQL> !sqlldr / control=student.ctl
    SQL*Loader: Release 11.2.0.3.0 - Production on Tue Mar 19 14:37:31 2013
    Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
    Commit point reached - logical record count 5
    SQL> select * from student;
    STUDENT_ID STUDENT_FN                     GENDER STUDENT_LN
           110 abc                            F      xyz
           120 def                            M      pqr
           130 ghi                            M      stu
           140 jkl                            F      vwx
           150 mno                            F      yza
    SQL>:p

  • How to insert data in tables using loops sql

    Oracle 10.2g
    using Oracle sql*plus
    Table student is
    create table student(id)
    as
    select distinct student_id
    from students_table;now
    desc student; will retrieve
    student
    ======
    Name         Null?    Type
    ===========================
    ID                  VARCHAR2(10)Now creating a sequence
    create sequence st_seq;
    alter table student add column no;
    select * from student
    no       id
    =========
            234
            298
    This is the main part
    There are 100 student id in the table
    now i want to populate the table with sequences using seq.next_val
    how to use a loop to insert 100 auto generated numbers in the table.
    Thank you.
    Expected result
    Select * from student
    no     id
    =========
    1     234
    2     298
    .........Why i am doing this way instead of
    create table student(no,id)
    as
    select st_se.nextval,student_id
    from students;This will cause duplication of upn
    using distinct would throw an error.
    create table student(st_id,id)
    as select distinct st_seq.nextval,academicyear
    from student
    as select distinct st_seq.nextval,academicyear
    ERROR at line 2:
    ORA-02287: sequence number not allowed hereThank you.

    Follow the example:
    SQL> create table students_table (student_id number);
    Table created.
    SQL> insert into students_table values(10);
    1 row created.
    SQL> insert into students_table values(10);
    1 row created.
    SQL> insert into students_table values(20);
    1 row created.
    SQL> insert into students_table values(30);
    1 row created.
    SQL> insert into students_table values(40);
    1 row created.
    SQL>
    SQL> commit;
    Commit complete.
    SQL> select *
    2 from students_table;
    STUDENT_ID
    10
    10
    20
    30
    40
    SQL> create sequence st_seq;
    Sequence created.
    SQL> create table student(no,id)
    2 as
    3 with distinct_table as
    4 (
    5 select distinct student_id
    6 from students_table
    7 order by student_id
    8 )
    9 select st_seq.nextval, student_id
    10 from distinct_table
    11 ;
    Table created.
    SQL> select *
    2 from student;
    NO ID
    1 10
    2 20
    3 30
    4 40
    SQL>
    Cheers,
    Davide

  • How to find a dependent row in the all tables using single SQL query

    hi all,
    I have created some table with master and some dependent tables.I want to mark a (row)tuple as inactive in master so that corresponding child records also should be marked as inactive.
    So i decided to mark the master and dependent records as inactive starting from master table and traverse to child tables.
    So I need SQL query to fetch all dependend records to the row(marked row in the master ) from the master table and dependent rows from the child row and to mark as flag inactive.
    can anybody help me out to build this query or any other way to mark flag as inactive ?
    Regards
    punithan

    You can find dependant tables from ALL_CONSTRAINTS, e.g:
    SQL> CREATE TABLE m (id INT PRIMARY KEY, flag VARCHAR2(1) NOT NULL);
    Table created.
    SQL> CREATE TABLE d1 (m_id REFERENCES m, flag VARCHAR2(1) NOT NULL);
    Table created.
    SQL> CREATE TABLE d2 (m_id REFERENCES m, flag VARCHAR2(1) NOT NULL);
    Table created.
    SQL> SELECT table_name, owner, status
      2  FROM   all_constraints c
      3  WHERE  c.constraint_type = 'R'
      4  AND    ( c.r_owner, c.r_constraint_name ) IN
      5         ( SELECT owner, constraint_name
      6           FROM   user_constraints
      7           WHERE  table_name = 'M'
      8           AND    constraint_type IN ('U','P') );
    TABLE_NAME                     OWNER                          STATUS
    D2                             WILLIAMR                       ENABLED
    D1                             WILLIAMR                       ENABLED
    2 rows selected.There is no SQL command to apply all updates in one go, if that's what you were looking for.
    AFAIK the word "tuple" is for mathematics and relational theory, and does not refer to a physical row in a database.

  • How many extents allocated when table created?

    I am using Oracle 9,
    is the number going to be what we specified by minextents?
    thanks

    Srinivas,
    You said,
    If its AUTOALLOCATE , Oracle starts with 1 extent of 64KB , then 128KB as the first extent becomes full, then 256KB so on....
    Can you help me in understanding this statement?I don't think that its true. See here,
    SQL> select * from V$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    SQL> drop tablespace test including contents and tablespaces;
    drop tablespace test including contents and tablespaces
    ERROR at line 1:
    ORA-00905: missing keyword
    SQL> drop tablespace test including contents and datafiles;
    Tablespace dropped.
    SQL> create tablespace test datafile 'd:\test.dbf' size 100m extent
    ocal autoallocate ;
    Tablespace created.
    SQL> select tablespace_name,initial_extent,next_extent from dba_tab
      2  where tablespace_name='TEST'/
      3
    SQL> select tablespace_name,initial_extent,next_extent from dba_tab
      2  where tablespace_name='TEST'
      3  /
    TABLESPACE_NAME                INITIAL_EXTENT NEXT_EXTENT
    TEST                                    65536
    SQL> --Creating a table inside in this tablespace
    SQL> create table t as select * from dba_objects;
    Table created.
    SQL> alter table t move tablespace test;
    Table altered.
    SQL> select tablespace_name, extent_id, bytes/1024, blocks
      2  from user_extents
      3  where segment_name = 'T';
    TABLESPACE_NAME                 EXTENT_ID BYTES/1024     BLOCKS
    TEST                                    0         64          8
    TEST                                    1         64          8
    TEST                                    2         64          8
    TEST                                    3         64          8
    TEST                                    4         64          8
    TEST                                    5         64          8
    TEST                                    6         64          8
    TEST                                    7         64          8
    TEST                                    8         64          8
    TEST                                    9         64          8
    TEST                                   10         64          8
    TABLESPACE_NAME                 EXTENT_ID BYTES/1024     BLOCKS
    TEST                                   11         64          8
    TEST                                   12         64          8
    TEST                                   13         64          8
    TEST                                   14         64          8
    TEST                                   15         64          8
    TEST                                   16       1024        128
    TEST                                   17       1024        128
    TEST                                   18       1024        128
    TEST                                   19       1024        128
    TEST                                   20       1024        128
    21 rows selected.
    SQL>
    SQL> insert into t select * from t;
    50356 rows created.
    SQL> /
    100712 rows created.
    SQL> /
    201424 rows created.
    SQL> /
    402848 rows created.
    SQL> commit;
    Commit complete.
    SQL> analyze table t compute statistics;
    Table analyzed.
    SQL> select tablespace_name, extent_id, bytes/1024, blocks
      2  from user_extents
      3  where segment_name = 'T';
    TABLESPACE_NAME                 EXTENT_ID BYTES/1024     BLOCKS
    TEST                                    0         64          8
    TEST                                    1         64          8
    TEST                                    2         64          8
    TEST                                    3         64          8
    TEST                                    4         64          8
    TEST                                    5         64          8
    TEST                                    6         64          8
    TEST                                    7         64          8
    TEST                                    8         64          8
    TEST                                    9         64          8
    TEST                                   10         64          8
    TABLESPACE_NAME                 EXTENT_ID BYTES/1024     BLOCKS
    TEST                                   11         64          8
    TEST                                   12         64          8
    TEST                                   13         64          8
    TEST                                   14         64          8
    TEST                                   15         64          8
    TEST                                   16       1024        128
    TEST                                   17       1024        128
    TEST                                   18       1024        128
    TEST                                   19       1024        128
    TEST                                   20       1024        128
    TEST                                   21       1024        128
    TABLESPACE_NAME                 EXTENT_ID BYTES/1024     BLOCKS
    TEST                                   22       1024        128
    TEST                                   23       1024        128
    TEST                                   24       1024        128
    TEST                                   25       1024        128
    TEST                                   26       1024        128
    TEST                                   27       1024        128
    TEST                                   28       1024        128
    TEST                                   29       1024        128
    TEST                                   30       1024        128
    TEST                                   31       1024        128
    TEST                                   32       1024        128
    TABLESPACE_NAME                 EXTENT_ID BYTES/1024     BLOCKS
    TEST                                   33       1024        128
    TEST                                   34       1024        128
    TEST                                   35       1024        128
    TEST                                   36       1024        128
    TEST                                   37       1024        128
    TEST                                   38       1024        128
    TEST                                   39       1024        128
    TEST                                   40       1024        128
    TEST                                   41       1024        128
    TEST                                   42       1024        128
    TEST                                   43       1024        128
    TABLESPACE_NAME                 EXTENT_ID BYTES/1024     BLOCKS
    TEST                                   44       1024        128
    TEST                                   45       1024        128
    TEST                                   46       1024        128
    TEST                                   47       1024        128
    TEST                                   48       1024        128
    TEST                                   49       1024        128
    TEST                                   50       1024        128
    TEST                                   51       1024        128
    TEST                                   52       1024        128
    TEST                                   53       1024        128
    TEST                                   54       1024        128
    TABLESPACE_NAME                 EXTENT_ID BYTES/1024     BLOCKS
    TEST                                   55       1024        128
    TEST                                   56       1024        128
    TEST                                   57       1024        128
    TEST                                   58       1024        128
    TEST                                   59       1024        128
    TEST                                   60       1024        128
    TEST                                   61       1024        128
    TEST                                   62       1024        128
    TEST                                   63       1024        128
    TEST                                   64       1024        128
    TEST                                   65       1024        128
    TABLESPACE_NAME                 EXTENT_ID BYTES/1024     BLOCKS
    TEST                                   66       1024        128
    TEST                                   67       1024        128
    TEST                                   68       1024        128
    TEST                                   69       1024        128
    TEST                                   70       1024        128
    TEST                                   71       1024        128
    TEST                                   72       1024        128
    TEST                                   73       1024        128
    TEST                                   74       1024        128
    TEST                                   75       1024        128
    TEST                                   76       1024        128
    TABLESPACE_NAME                 EXTENT_ID BYTES/1024     BLOCKS
    TEST                                   77       1024        128
    TEST                                   78       1024        128
    TEST                                   79       8192       1024
    TEST                                   80       8192       1024
    TEST                                   81       8192       1024
    82 rows selected.
    SQL>Its not working in the way youmentioned. The extents are of 65kb till 16 extents than it changes to 1024kb untill 78 and then 8192 kb. Is it something that I am missing?
    Aman....

  • Unexpected table created after schema registration

    I registered the following xsd. Even though I did not specify any tables to be created, I see a table in "user_xml_tables". Could someone explain what's going on? Thank you.
    1. This is the xsd file.
    <xsd:schema version="1.0" xdb:storeVarrayAsTable="false" xdb:mapUnboundedStringToLob="false" xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:complexType name="val_type">
    <xsd:sequence>
    <xsd:element name="e1" type="xsd:integer" />
    <xsd:element name="e2" type="xsd:integer" />
    </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="coll5_type" xdb:SQLType="coll5_sqltype">
    <xsd:sequence >
    <xsd:element name="val" type="val_type" maxOccurs="200"
    xdb:SQLInline="false"/>
    <xsd:element name="val2" type="xsd:integer" xdb:SQLType=
    "INTEGER" />
    </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>
    2.Register the schema
    BEGIN
    DBMS_XMLSCHEMA.registerSchema(
    SCHEMAURL => 'http://oracle.com/xdb/coll2.xsd',
    SCHEMADOC => bfilename('TICKERDIR','coll2.xsd'),
    LOCAL =>TRUE,
    GENTYPES => TRUE,
    GENTABLES => TRUE,
    CSID => nls_charset_id('AL32UTF8'));
    END;
    3. ************ Why is this table created? ******************************************
    SQL> select table_name from user_xml_tables;
    TABLE_NAME
    val777_TAB
    SQL> desc "val777_TAB"
    Name Null? Type
    TABLE of SYS.XMLTYPE(XMLSchema "http://bloomberg.com/xdb/coll2.xsd" Element "val") STORAGE Object-relational TYPE "val_type776_T"
    SQL> desc "val_type776_T"
    "val_type776_T" is NOT FINAL
    Name Null? Type
    SYS_XDBPD$ XDB.XDB$RAW_LIST_T
    e1 NUMBER(38)
    e2 NUMBER(38)

    I do not think this is because GENTABLES=> TRUE is set.
    1. Note that for the posted schema, a table is created only for coll5_type, but not val_type.
    2. I modifed the schema as follows (see below): Its the same as the original except that we have two additional complex types, we still have ONE table that is generated. We should expect THREE tables to be generated if the expected behaviour of GENTABLES=> TRUE is to create tables for every complexType.
    3. If you remove coll5_type from the modified schema, there are NO tables generated.
    Conclusion: the table is generated only if the complexType has a collection with SQLInline="false" : i.e. we require a varray of REF storage.
    What's the reason for this behaviour?
    1. Here's the modified xsd:
    This schema has:
    a) has 3 complex types defined
    b). no global elements (tables are supposed to be generated only for global elements)
    3. no tables have been specified in the xsd.
    <?xml version="1.0" encoding="windows-1252"?>
    <xsd:schema version="1.0" xdb:storeVarrayAsTable="false" xdb:mapUnboundedStringT
    oLob="false" xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:xsd="http://www.w3.or
    g/2001/XMLSchema">
    <xsd:complexType name="val_type">
    <xsd:sequence>
    <xsd:element name="e1" type="xsd:integer" />
    <xsd:element name="e2" type="xsd:integer" />
    </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="coll3_type" xdb:SQLType="coll3_sqltype">
    <xsd:sequence >
    <xsd:element name="val" type="val_type" xdb:SQLCollType=
    "coll3_sqlcolltype" maxOccurs="200"/>
    <xsd:element name="val2" type="xsd:integer" xdb:SQLType=
    "INTEGER" />
    </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="coll4_type" xdb:SQLType="coll4_sqltype">
    <xsd:sequence >
    <xsd:element name="val" type="val_type" maxOccurs="200"
    xdb:SQLCollType="CLOB" />
    <xsd:element name="val2" type="xsd:integer" xdb:SQLType=
    "INTEGER" />
    </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="coll5_type" xdb:SQLType="coll5_sqltype">
    <xsd:sequence >
    <xsd:element name="val" type="val_type" maxOccurs="200"
    xdb:SQLInline="false"/>
    <xsd:element name="val2" type="xsd:integer" xdb:SQLType=
    "INTEGER" />
    </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>
    2.
    BEGIN
    DBMS_XMLSCHEMA.registerSchema(
    SCHEMAURL => 'http://bloomberg.com/xdb/coll2.xsd',
    SCHEMADOC => bfilename('TICKERDIR','coll2.xsd'),
    LOCAL =>TRUE,
    GENTYPES => TRUE,
    GENTABLES => TRUE,
    CSID => nls_charset_id('AL32UTF8'));
    END;
    3.
    SQL> select table_name from user_xml_tables;
    TABLE_NAME
    val779_TAB

  • How to determine via SQL who created the sales order

    Hello I am trying to determine via SQL who created the Sales Order.  I'm looking at the ADOC table but having a hard time determining which record points to the sales order creation.

    Hi Jimmy,
    Try this:
    select
         T0.[DocNum], T2.[DocDate], T2.[CardCode], T2.[CardName],
         T1.U_NAME as [User Name], T2.UpdateDate as [Cancelled Date]
    from
         ORDR T0
         inner join OUSR T1 on T0.UserSign = T1.UserID
         inner join ADOC T2 on T0.DocNum = T2.DocNum
    where
         T2.LogInstanc = (select min(LogInstanc) from ADOC T3 where T3.ObjType = 17 and T3.DocNum = T0.DocNum and T3.CANCELED = 'Y')
         and T2.CANCELED = 'Y'
         and T2.ObjType = 17
    group by
         T0.DocNum, T2.DocDate, T2.CardCode, T2.CardName, T1.U_NAME, T2.UpdateDate
    Kind Regards,
    Owen

  • Creating APEX pages via SQL scripts..

    Hi Guys,
    I want to create APEX pages via SQL Script. The main reason to have this option that I have couple of applications which has XML files for screen definition where I can read all screen properties (field types, sizes, caption, etc...)
    Is there any documentation or help stuff where I can find the APEX page definition tables? I found something like WWV tables but I couldnt figure it out properly...
    Any help ?
    Thanks,
    Osman...

    We have built our entire apex app in a similar way. We create the shell apex pages using apex (eg, Item Detail, Insert Item, etc.). Then we create a PL/SQL region on the page. The PL/SQL region simply calls a stored procedure to render the controls on the page. For example, our regions looks similar to this:
    begin
    apex_pkg.sp_render_page('ITEM_DETAIL',Param1,Param2,Param3);
    end;
    The sp_render_page procedure in the database generates the appropriate HTML for the page. This procedure reads meta data in the database (eg, field label, field size, field type, field position, etc.) and renders the same HTML that apex would render if the apex page was manually created. For example, in the procedure we use lines similar to these:
    HTP.p(apex_item.text(...))
    HTP.p(apex_item.select_list_from_query(...))
    Because the procedure is reading meta data, the apex page is dynamic and can be different for different users or clients.
    Darrin

  • Syntax error when creating a user-defined table type in SQL Server 2012

    Why am I getting a syntax error when creating a user-defined table type in SQL Server 2014?
    CREATE TYPE ReportsTableType AS TABLE 
    ( reportId INT
    , questionId INT
    , questionOrder INT );
    Results:
    Msg 156, Level 15, State 1, Line 1
    Incorrect syntax near the keyword 'AS'.

    Hope these posts could help, 
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/37a45a9a-ed8c-4655-be93-f6e6d5ef44be/getting-incorrect-syntax-while-creating-a-table-type-in-sql-server-2008-r2?forum=transactsql
    Regards, Dineshkumar,
    Please Mark as Answer if my post answers your question and
    Vote as Helpful if it helps you

  • Unable to establishing a connection to SQL Server created via SqlManagementClient

    Goal:
    create an Azure SQL Server via .NET (Microsoft.WindowsAzure.Management.Sql.Modules.SqlManagementClient) and add a database to it.
    Problem:
    I am NOT able to access the newly created server from .Net code.
    Description:
    Using SqlManagementClient I SUCCESFULLY create a new Azure SQL Server (see code below).
    After creating the server, I am able to access the new server from Azure Portal.
    * firewall rule show valid client machine
    * "Windows Azure Services" is set to "Yes"
    An error occures when I try connecting to the database using the same user and pwd used to create it. 
    /* the following code results in a connection failure  */
    //string server = <name of newly created sql server>
    //string db = <name of new database to create, inside of the server>
    public void CreateDatabase(string server, string db)
     using (ReliableSqlConnection conn = new ReliableSqlConnection(
                    Configuration.GetConnectionString(server, "Master"),
                    SqlRetryPolicy,
                    SqlRetryPolicy))
                    conn.Open();   //// throws System.Data.SqlClient.SqlException
        //// A network-related or instance-specific error occurred while establishing a connection to SQL Server.
                    SqlCommand cmd = conn.CreateCommand();
    /* the following code creates a sql server and firewall rules */
    ServerCreateResponse response;
    SubscriptionCloudCredentials creds;
    X509Certificate2 cert;
    //// Gets the certificate  
    cert = CredentialUtil.GetCertificate(certificateStoreName, certificateStoreLocation, certificateThumbprint);
    //// Using the certificate and the subscription build credential
    creds = new CertificateCloudCredentials(azureSubscriptionId, cert);
    //// using creditials create server and set firewall rules
    using (SqlManagementClient client = new SqlManagementClient(creds))
            response = client.Servers.Create(new ServerCreateParameters()
                    AdministratorPassword = sqlPwd,
                    AdministratorUserName = sqlUser,
             Location = location
            if (response.StatusCode == HttpStatusCode.Created)
      //// 0.0.0.0 is added to enable "Windows Azure Services" on the "Configure" tab.
      //// <MyInternetIp> would be my actual IP address.
      //// - (which works for other servers that i have manualy registered
      validIPs = new List<string>() {"0.0.0.0", "<MyInternetIp>"};
      CreateFireWallRule(client, response.ServerName, validIPs);
    //// Adds IP to Azure firewall.
    private static void CreateFireWallRule(SqlManagementClient client, string azureServerName, IEnumerable<string> validIPs)
                foreach (string ip in validIPs)
                    FirewallRuleCreateParameters rule = new FirewallRuleCreateParameters() { Name = string.Format("Allow {0} - {1}", Environment.MachineName, ip), StartIPAddress
    = ip, EndIPAddress = ip };
                    client.FirewallRules.Create(azureServerName, rule);
    /// Error
    System.Data.SqlClient.SqlException was unhandled
      HResult=-2146232060
      Message=A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.
    (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
      Source=.Net SqlClient Data Provider
      ErrorCode=-2146232060
      Class=20
      LineNumber=0
      Number=53
      Server=""
      State=0

    Using SqlManagementClient I SUCCESFULLY create a new Azure SQL Server.
    ServerCreateResponse response;
    SubscriptionCloudCredentials creds;
    X509Certificate2 cert;
    cert = CredentialUtil.GetCertificate(parameters.CertificateStoreName, parameters.CertificateStoreLocation, parameters.CertificateThumbprint);
    creds = new CertificateCloudCredentials(parameters.AzureSubscriptionId, cert);
    using (SqlManagementClient client = new SqlManagementClient(creds))
                    response = client.Servers.Create(new ServerCreateParameters()
                        AdministratorPassword = parameters.SqlPwd,
                        AdministratorUserName = parameters.SqlUser,
                        Location = parameters.Location
                    if (response.StatusCode == HttpStatusCode.Created)
                        CreateFireWallRule(client, response.ServerName, parameters.ValidIPs);

  • Creating tables in pl/sql block

    I have the following piece of code that I execute in sqlplusw as @c:\process.sql
    On running @c:\process.sql, an input is provided as prompted. There is a
    declare and begin that processes some code. What I am looking for is -- Is there
    a way that I can check the all_tables view for the following 3 tables :
    TABLE1, TABLE2, TABLE3. Only on finding these tables, this
    anonymous sql (that is inside starting from declare ... should execute).
    If these tables are not found, I want to attempt creating the tables. If the attempt
    was successful, then process. If creating tables attempt fails, exit with a dbms_output.put_line message and don't process
    anything....
    Can this be done ? If so, any hints would be great.....
    Thanks
    ACCEPT input_ssn prompt 'Enter SSN :'
    SET feedback off
    SET serveroutput on
    SET echo off
    SET term off
    SET heading off
    SET pagesize 0
    SET linesize 10000
    SET verify off
    undefne sdate input_ssn
    COL sdate new_value sdate
    COL input_ssn new_value input_ssn
    SELECT TO_CHAR (SYSDATE, 'YYYYMMDD') sdate
    FROM DUAL;
    SPOOL C:\SCRUB_DATA_&&sdate._&&input_ssn..TXT
    SELECT 'REPORT GENERATED ON : ' || SYSDATE
    FROM DUAL;
    ALTER TRIGGER TRIG1 DISABLE;
    DECLARE
    BEGIN
    FOR i IN .........
    LOOP
    END LOOP;
    BEGIN
    SELECT ..........
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    NULL;
    END;
    UPDATE ...........
    FOR i IN .....
    LOOP
    UPDATE ....
    BEGIN
    SELECT ...
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    NULL;
    END;
    UPDATE ...
    BEGIN
    SELECT ....
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    NULL;
    END;
    UPDATE ...
    END LOOP;
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
         NULL;
    WHEN OTHERS
    THEN
    ecode := SQLCODE;
    emesg := SQLERRM;
    DBMS_OUTPUT.put_line ('Error code is : '||' - '|| ecode);
    DBMS_OUTPUT.put_line ('Error message is :' || ' - ' || emesg);
    END;
    COMMIT ;
    ALTER TRIGGER TRIG1 ENABLE;
    SET term on
    SET HEADING on
    SELECT 'Processing complete for ' || '&&input_ssn'
    FROM DUAL;
    SPOOL off;
    SET verify on
    SET feedback on
    ----------------------------------------------------------

    This is what I am doing :
    ACCEPT input_ssn prompt 'Enter SSN :'
    SET feedback on
    SET serveroutput on
    SET echo on
    SET term on
    SET heading on
    SET pagesize 0
    SET linesize 10000
    SET verify on
    undefne sdate input_ssn
    COL sdate new_value sdate
    COL input_ssn new_value input_ssn
    SELECT TO_CHAR (SYSDATE, 'YYYYMMDD') sdate
    FROM DUAL;
    SPOOL C:\TEMP_DATA_&&sdate._&&input_ssn..TXT
    ALTER TRIGGER TRIG1 DISABLE;
    DECLARE
    v_postal cheque.postal%TYPE;
    v_count NUMBER;
    l_tabexist NUMBER;
    BEGIN
    DBMS_OUTPUT.PUT_LINE('HELLO THERE');
         BEGIN
              DBMS_OUTPUT.PUT_LINE('HI THERE');
              SELECT 1 INTO l_tabexist FROM all_tables
                   WHERE table_name = 'TABLE1_TEMP' AND owner='HARPER';
         EXCEPTION
              WHEN NO_DATA_FOUND THEN
                   EXECUTE IMMEDIATE 'CREATE TABLE TABLE1_TEMP AS SELECT * FROM TABLE1 WHERE 1=2';
                   EXECUTE IMMEDIATE 'ALTER TABLE TABLE1_TEMP ADD(TEMP_STATUS VARCHAR2(1))';
         END;
         BEGIN
                   SELECT 1 INTO l_tabexist FROM all_tables
                        WHERE table_name = 'TABLE2_TEMP' AND owner='HARPER';
              EXCEPTION
                   WHEN NO_DATA_FOUND THEN
                        EXECUTE IMMEDIATE 'CREATE TABLE TABLE2_TEMP AS SELECT * FROM TABLE2 WHERE 1=2';
                        EXECUTE IMMEDIATE 'ALTER TABLE TABLE2_TEMP ADD(TEMP_STATUS VARCHAR2(1))';
         END;
    BEGIN
    <my code that uses TABLE1_TEMP and TABLE2_TEMP supposed to be created above>
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    DBMS_OUTPUT.put_line ('No Data Found Exception encountered');
    END;
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.Put_Line('Something bad happened');
    RAISE;
    END;
    COMMIT ;
    ALTER TRIGGER TRIG1 ENABLE;
    SET term on
    SET HEADING on
    SPOOL off;
    SET verify on
    SET feedback on
    What is happening here is that until ALTER TRIGGER DISABLE, things are fine.
    Then, it tries to process <my code> and cries saying 'Table or view not found'. Finally it enables the trigger back.
    It is not even displaying either the 'HELLO THERE' or 'HI THERE' - which I suppose is the first thing it should have done.
    Thanks

Maybe you are looking for

  • Error in Transporting Update Rules

    Hi, I am transporting ODS, Info package and UPdate Rule from Dev to QA. I request seems to be fine, but transport ended in error. ODS, IP and UR got transported , but the UR is inactive. and i dont havr the permission to activate that in QA system. W

  • Ipad mini stuck in recovery mode after ios 8.1 update

    i have a first generation ipad mini which usually works fine.  last night the ios update appeared in my settings and i tried to install it. i didnt have enough space so deleted some apps and then installed. the ipad switched on at the end but said th

  • Macbook Core 2 Duo noise

    I bought a white core 2 duo 2 gh macbook a few days ago. There is a strange buzzing sound underde the keybord. It did'nt happen in the former macbook core duo. Is it normal or not? Could it be provoked by the new chip? Thank you...

  • Switching to a different workspace in Netbeans 6.1

    I have my workspace for Netbeans set to my laptop hard drive but now I would like to put it on my external hard drive. 1. What do I have to worry about? 2. Whats the best way to do it? Thanks

  • ITunes constantly freezing - unable submit my password as the field is 'frozen'

    Whenever I launch iTunes I get this screen but I can't access any of the fields as they are frozen.