SQL to align the values of the child with the parent columns

Hello world

I'm stumped on how to develop a sql query that generates a report which my child values are aligned with my columns parent based on corresponding years.  Here is an example...

create table test_yr (yr_id number primary key, yr_nb number);
insert into test_yr values (1,2013);
insert into test_yr values (2,2014);
insert into test_yr values (3,2015);

create table test_parent (parent_id number primary key, parent_yr_id_begin number, parent_title varchar2(100));
alter table test_parent add foreign key (parent_yr_id_begin) refererences test_yr (yr_id);
insert into test_parent values (1,1,'This rec starts in 2013');

create table test_child (
     child_id number primary key,
     child_parent_id number,
     child_yr_id_begin number,
     child_title varchar2(100),
     child_yr1_val number, child_yr2_val number, child_yr3_val number, child_yr4_val number, child_yr5_val number
);
alter table test_child add foreign key (child_parent_id) references test_parent (parent_id);
alter table test_child add foreign key (child_yr_id_begin) references test_yr (yr_id);
insert into test_child values (1,1,3,'This rec starts in 2015',10,20,30,40,50);
insert into test_child values (2,1,3,'This rec starts in 2015',15,25,35,45,55);


The child can begin to another to start the year as the parent, which makes different yr1 for parent and yr1 for child.  So, for this example, the child 1 year (2015) = year 3 of the parent.

I can get the values strictly of the child using the following...

select child_yr1_val, child_yr2_val, child_yr3_val, child_yr4_val, child_yr5_val
from test_child
where child_parent_id = 1;

However, I need the report to be based on the first five years of the parent.  And since the child does not start until 2015, two years should be zero.  This is the expected result:

Yr1 | YR2 | YR3 | yr4 | Yr5

---------------------------

0   | 0   | 10. 20. 30

0   | 0   | 15. 25. 35

I am doing it using simple sql without having to use pl/SQL to derive a dynamic query.  But I need to somehow to the height and line up the years... like in this example, yr1 (child) = yr3 (parent), (child) yr2 = yr4 (parent), etc..  I hope that some joints and case statements will do the trick, but I don't know how to use them to get the result that I need.  Can anyone help?  Oracle 11 g 2.

Thank you

Mark

Hi, Mark,.

Here's one way:

WITH unpivoted_child AS

(

SELECT child_id, child_parent_id

child_yr_id_begin + child_yr - 1 AS column_num

val

OF test_child

UNPIVOT (val

FOR child_yr (child_yr1_val AS 1

child_yr2_val AS 2

child_yr3_val AS 3

child_yr4_val AS 4

child_yr5_val AS 5

)

)

WHERE child_parent_id = 1

)

SELECT NVL (y1, 0) AS yr1

, NVL (y2, 0) AS yr2

, NVL (y3, 0) AS an3

, NVL (y4, 0) AS yr4

, NVL (y5, 0) AS yr5

Of unpivoted_child

PIVOT (SUM (val)

FOR column_num IN (1 AS y1

2 AS y2

3 AS y3

4 AS y4

5 AS y5

)

)

ORDER BY child_parent_id

child_id

;

Have 5 columns in the test_child that all say the same thing, obly for different years, isn't a very good design table.  It wouyld be better to have a single table for all the attriburtes that apply to the child and another table for each combination of year, with a single amount on each line.  Because you don't have that, the unpivoted_child of the subquery, it essentially creates on the fly.

Tags: Database

Similar Questions

  • A question about the insertion of the localTimeStamp returned the value into a timestamp with time zone column

    Hello

    Oracle version: Enterprise Edition Release 12.1.0.1.0 - 64 bit

    OS: CentOS 4.6 X86_64                  

    I have a question about the localTimeStamp function. According to the documentation for this function is
    the same thing as current_TimeStamp except that the returned value does not include the time zone.

    Consider the following example:

    SQL > create table tmptab (colval timestamp with time zone not null);

    Table created.

    SQL > insert into tmptab (colval) values (localTimeStamp);

    1 line of creation.

    SQL > select t1.colval, tmptab from t1;

    COLVAL

    ---------------------------------------------------------------------------

    24 JANUARY 14 09.45.42.253732 H + 01:00

    SQL >

    Why introduce the foregoing did not fail? the data type of the column in my table colval expects a timestamp with time zone

    during each which inserts as I understand (correct me if I'm wrong) is not provided by the localTimeStamp function.

    Could someone kindly tell me what I misunderstood?

    Thanks in advance,

    dariyoosh wrote:

    Hello

    Oracle version: Enterprise Edition Release 12.1.0.1.0 - 64 bit

    OS: CentOS 4.6 X86_64                  

    I have a question about the localTimeStamp function. According to the documentation for this function is
    the same thing as current_TimeStamp except that the returned value does not include the time zone.

    Consider the following example:

    SQL > create table tmptab (colval timestamp with time zone not null);

    Table created.

    SQL > insert into tmptab (colval) values (localTimeStamp);

    1 line of creation.

    SQL > select t1.colval, tmptab from t1;

    COLVAL

    ---------------------------------------------------------------------------

    24 JANUARY 14 09.45.42.253732 H + 01:00

    SQL >

    Why introduce the foregoing did not fail? the data type of the column in my table colval expects a timestamp with time zone

    during each which inserts as I understand (correct me if I'm wrong) is not provided by the localTimeStamp function.

    Could someone kindly tell me what I misunderstood?

    Thanks in advance,

    Then, when you do

    create table t (neck DATE);

    Insert into t (to_date ('1st January 2014', ' mon-dd-yyyy "");)

    Are you surprised that it works? After all a DATE column contains a time component, you do not provide: but he

    works and gives you 00:00:00 as the component "hour".

    Similarly, the timezone component is being developed to automatically with, I think, time zone of your system.

  • Rename the Parent - foreign key columns

    I need to rename a bunch of parent columns that are referenced in the foreign key constraints. Is it possible to get the child column get automatically updated with the new name of the parent column?

    IE, I have a table named 'subject' with a PK named subjectID. I have a child table addresses that child has a FK to subject.subjectID and the column is automatically named subject_subjectID.

    Now, I want to rename just subject.subjectID "ID". I want this rename also take place in the referencing table "address" so the name change should be translated as subject_ID.


    Thank you!

    You can set {ref column} as for 'Foreign key column' "tools > preferences > Data Modeler > designation standard > Templates.
    And to request that it uses "Apply to keys and constraints naming standards" in the context menu for relational model in the browser tree. Select only "foreign key column" it.

    Philippe

  • show the parent object of get - view - ViewType HostSystem

    I want to change the code snippet below (http://kb.vmware.com/kb/1012514) to include the parent object.

    Notice-EEG - ViewType HostSystem-Property Name, Config.Product. Select Name, {$_.} Config.Product.FullName}, {$_.} Config.Product.Build} | FT-auto

    When I run the modified version, I get 'ComputeResource-domain-sNNNN' or 'ClusterComputeResource-field-cNNN' in the Parent column. If I make one

    Get-Cluster ClusterComputeResource-field-cNNN

    I get the name of one of our groups. So I tried variations of the following, and I still can't get a good Parent.

    C:\ PowerCLI > notice-EEG - ViewType HostSystem-name of the property, Config.Product, Parent | Select Name, {$_.} Config.Product.FullName}, {$_.} Config. Product.Build}, ($_.) Parent | Get-cluster) | Sort - the name of the property. FT-auto

    Select: cannot convert System.Object [] to one of the following types {System.String, System.Management.Automation.ScriptBlock}.

    At line: 1 char: 72

    + view the GET - ViewType HostSystem-name of the property, Config.Product, Parent | Select Na...

    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo: InvalidArgument: (:)) [Select-Object], NotSupportedException)

    + FullyQualifiedErrorId: DictionaryKeyUnknownType, Microsoft.PowerShell.Commands.SelectObjectCommand

    PowerCLI C:\ >

    I realize that it does not help that, in some cases Parent will be a cluster object and in other cases it will be an object Folder or Data Center. I also tried

    .... $( if ( $_. Parent) {get-cluster-id $_.} Parent})

    .... ( if ( $_. Parent) {get-cluster-id $_.} Parent})

    .... (get-cluster-name ($_.)) Parent). Name)

    .... (get-cluster-name [string]($_.)) Parent). Name)

    (1) if I'm only looking on with parents of cluster hosts, is there a way to ignore all others?

    (2) how can I get the name of the parent cluster?

    Try like this

    Get-view ViewType - HostSystem-name of the property, Config.Product, Parent |

    Select Name,

    @{N = ' product'; E={$_. Config.Product.FullName}},

    @{N = 'Build'; E={$_. Config.Product.Build}},

    @{N = "Cluster"; E = {}

    $parent = get-view-Id $_. Parent - the Parent property name

    While ($parent - isnot [VMware.Vim.ClusterComputeResource] - and $parent. Parent) {}

    $parent is get-view-Id $parent. Parent - the Parent property name

    }

    If ($parent - is [VMware.Vim.ClusterComputeResource]) {}

    $parent. Name}}} |

    Format-Table-auto

  • parent columns and child

    Hello world

    I have a table "test_table" like below where there is a child column and the parent column. I need to write a query to find out the values of column of child who does not exist in the parent column. I wrote something like that works but is it the right way, or is there a better way?

    Thank you


    parent of the child
    100 200
    200 300
    300
    400

    Query:

    Select child test_table
    where mother <>

    Thank you.

    PK

    Hello

    The answer to your question is this query:

    SELECT t.child FROM test_table t
    WHERE NOT EXISTS (SELECT 1 FROM t1 test_table WHERE t1.child = t.parent);

    This get you all the lines where there is no parent with the same value.

    However: Why would you have a table like this one with the parent-child relationship within the same table?

  • Switch the setting to a page of the window parent child and store session values in the parent window

    Hello

    I have two pages of the apex. I open a page of the child using javascript in the parent page.

    Parent window has the following articles.  P1_Text1, P1_text2, P1_text3. The setting is 'Change only when the session state is null', static assignment.

    In the child window: I have two buttons 'Confirm' and 'close '.

    When I press "confirm", it sets the value of a page element parent in a process of PL/SQL.

    BEGIN

    / * some calculations

    followed by an assignment statement * /.

    : P1_Text1: = final_value;

    END;

    "Close" button in the child window. as a result of javascript that are associated with:

    JavaScript:

    Window.opener.Location.href = window.opener.location.href;

    Window.Close ();


    When I press the close button, the parent window gets updated and P1_Text1 is responsible for the requirements.  Everything is going well so far.


    But the problem is with other elements of the parent page. They become null.


    How to store the values of the elements of the page of the parent window?



    Kind regards

    Archana








    archana2 wrote:

    But the problem is with other elements of the parent page. They become null.

    How to store the values of the elements of the page of the parent window?

    Problem: You're not 'save' the other page elements.

    Solution: Before you open the child window, you need to "introduce" the values desired registered on the server.

    This is best done with a dynamic Action that uses a PL/SQL code block.  The key is to include all the items you want to store the property in the "Page" referred to submit

    PL/SQL code is a code simple no - ops

    begin
      null;
    end;
    

    For you, it seems that the 'child window open"should be action 2 of this dynamic Action.

    MK

  • align the cells with shared values

    3.6.1 the numbers

    I would like to compare two columns and align the cells, if they are equal. Ideally, I would like to include the adjacent cells in the second column in the alignment.

    Example:

    Run the formula (if possible) to format the following text:

    As follows:

    Hi cnickflight,

    Easy to do by transferring the data to another table.

    Table 1 contains the original data. I reduced the names of fruits to three letter codes to reduce type them, but this does not change the process.

    Column A of table 2 contains a formula that copies the existing data in column A of table 1 and insert null strings when there is no data in the table 1.

    The formula is entered in cell A2 and filled down.

    Table 2::A2: = IF (ROW () −1 > COUNTA (table 1::A),"', SHIFT (table 1::$A$1,ROW()−1,0))))

    Fill until the end of the column.

    Columns B and C contain a VLOOKUP formula. The formula is the same in the two columns, with the exception of the number indicating which column of the table, the returned value must come. The version of 'testing' of the formula in B2 is shown. When filled to the bottom, this formula should copy the names of fruits where they are both on the table 1, in the line that they appear in column A, and display a triangle of error in the lines where there is no name in column B to the one in the column (and in the rows where column A is empty). The error message for each of them should be "VLOOKUP couldn't find the requested value."

    Table 2::B2 (trial version): = VLOOKUP ($A, table 1: $b$ C, 1, FALSE)

    (FALSE appears in the formula as 'exact match' editor)

    If the behavior is as described, add IFERROR before VLOOKUP, and , "") after the closing parenthesis to match the 'final version'. " (See "why two versions? below.)

    2::B2 (final version) of the table: SIERREUR = (VLOOKUP ($A, table 1: $b$ C,1, FALSE),' ')

    2::C2 (final version) of the table: SIERREUR = (VLOOKUP ($A, table 1: $b$ C,2, FALSE),' ')

    Fill both until the end of their respective columns. Results should now be as shown above.

    Note: Why two versions?

    Function SIERREUR is ideal for use as a trap for the error, but it acts on all errors, not only the one you plan to trap. Best practice is to add to this trap only if you are sure that the formula generates other error messages that awaits you and using in this case we know VLOOKUP, who has been charged with finding an "exact match" will throw an error when it does. Function SIERREUR catches this error and puts a string anywhere in the cell, making it appear empty.

    Kind regards

    Barry

  • Do stuff to PL/SQl that returns the value and redirect to modal page by setting this value

    Hello

    a button click Page1 I would perform a PL/SQL procedure that returns a value in P1_ITEMVAL and then redirect to a page 2 (modal page) and the value of an item on this page with the value previously returned. To do the same thing with a normal page is quite easy:

    Button action is present, then process of PL/SQL that returns the value in the P1_ITEMVAL element and, finally, a branch at page 2 that sets P2_ITEMVAL with P1_ITEMVAL. I really have no idea how to do the same thing when the target is a modal page.

    I created a unit test on https://apex.oracle.com/pls/apex (application 1554 - redir_to_modal)

    Workspace: tests

    USER: supporter

    PWD: supporter1234

    Any help would be much appreciated.

    Kind regards

    Pavel

    Pavel

    If you prepare a URL using the value calculated in the PLSQL of DA part you can then use a subsequent stage of javascript to set the location of the window.

    This will jump to the top of the page of the modal dialog box

    : P1_URL: = apex_util.prepare_url)

    ' f ? p ='|| : APP_ID - Application id

    |': 2' - Page id

    ||': ' || : APP_SESSION - Session id

    ||':'                      -- Request

    ||':NO'                    -- Debug

    : ': ' - Clear Cache

    : ': ' - Settings

    ||' P2_ITEMVAL'

    : ': ' - Parameter values

    || (: P1_ITEMVAL);

    then in the action of javascript

    Window.Location.Replace ($v ('P1_URL'));

    Hope this is of some use

    Concerning

    Kelvin

  • While the BLOB conversion of type CLOB error - ORA-06502: PL/SQL: digital error or value

    Passing data from attachment of DB (Blob data Type) after the CLOB data type conversion, giving the error "ORA-06502: PL/SQL: digital error or value" in the PL/SQL package. If the BLOB size 32K > it will give another error works great my procedure.

    For example, I enclose my code here.

    function get_base64 (p_blob_in in blob) return clob is

    CLOB v_clob;

    CLOB v_result;

    whole v_offset;

    v_chunk_size PLS_INTEGER: = 12288;

    v_buffer_varchar varchar2 (32767).

    v_buffer_raw raw (32767).

    Start

    fnd_file.put_line (fnd_file.log, 'here');

    If p_blob_in is null then

    Returns a null value.

    end if;

    DBMS_LOB.CREATETEMPORARY (v_clob, true);

    fnd_file.put_line (fnd_file.log, 'here1');

    v_offset: = 1;

    fnd_file.put_line (fnd_file.log, 'Loop value'-| ceil (DBMS_LOB.) GetLength (p_blob_in) / v_chunk_size));

    because me in 1... ceil (DBMS_LOB. GetLength (p_blob_in) / v_chunk_size) loop

    DBMS_LOB. Read (p_blob_in, v_chunk_size, v_offset, v_buffer_raw);

    v_buffer_raw: = utl_encode.base64_encode (v_buffer_raw);

    v_buffer_varchar: = utl_raw.cast_to_varchar2 (v_buffer_raw);

    DBMS_LOB. WriteAppend (v_clob, length (v_buffer_varchar), v_buffer_varchar);

    v_offset: = v_offset + v_chunk_size;

    end loop;

    fnd_file.put_line (fnd_file.log, 'Out of the loop');

    v_result: = v_clob;

    fnd_file.put_line (fnd_file.log, 'V_result length' - |) DBMS_LOB. GetLength (v_result));

    fnd_file.put_line (fnd_file.log, 'V_result' - | v_result);

    DBMS_LOB.freeTemporary (v_clob);

    Return v_result;

    exception

    while others then

    fnd_file.put_line (fnd_file.log, 'Error based on the encode_base64' - |) SQLERRM);

    Returns a null value.

    end;

    In my main program I call this function as below:

    Main proceedings...

    l_return_clob CLOB.

    Begin

    ....

    l_return_clob: = get_base64 (p_blob_in);

    -In returning it gives error - ORA-06502: PL/SQL: digital error or value

    end;

    Then, please mark the thread ANSWERED.

  • Lineage tracing an SQL error: ORA-22813: value of the operand exceeds the limits of the system

    Hi all

    I started playing with OEMM and I get the following error when I try to 'Trace Data Impact' in an Oracle table. Here's what I do:

    • I created a template and collected a few schemas/tables:

    Capture.JPG

    Capture1.JPG

    • Now when I try to "Trace Data Impact' on the table AP_DEF_STG, I get the following:

    Capture2.JPG

    Capture3.JPG

    Capture4.JPG

    I already tried to create a "Configuration" for her, I tried to text instead of graphics, but the error is the same. If I go to a view of Oracle and do a "track Data Lineage", I get the same error again.


    That someone was already been in this situation? This is the full error trace:


    ({"error": true, "errorMessage": "SQL error during the tracing of lineage: ORA-22813: value of the operand exceeds the limits of the system"})

    ', 'errorType': 'Line error', 'errorCodes': "[LNGTRC_E0016]".

    ","stackTrace":"Error Codes - [LNGTRC_E0016].

    Request - VizModelLineage

    Settings - showInternalObject [false] showNoType [true] showControlLinks [false] startingIds [17 #4723 #0] isBizUI [false] ObjectID [17 #1 #0] showSummaryView [true] collapseLevel [features] resetCache [fake] profile [] showMappingsAsNodes [true] skipCache [false] tracingDirection [3] tracingType [DataLineage] [ReportTree2202015-104855025] originalStartingObject cacheId [17 #4723 #0] viewType actionType [loadlineage] of viewId [ReportTree2202015-104855025] [ModelLineage]

    MITI.web.common.exceptions.LineageUIException: SQL for tracing line error: ORA-22813: value of the operand exceeds the limits of the system

    at MITI.web.common.service.facades.LineageFacadeImpl.getLineageGraph (LineageFacadeImpl.java:284)

    at MITI.flash.tabs.VizModelLineage.getLineageTree (VizModelLineage.java:429)

    at MITI.flash.tabs.VizModelLineage.buildLineageGraph (VizModelLineage.java:356)

    at MITI.flash.tabs.VizModelLineage.performAction (VizModelLineage.java:148)

    at MITI.server.servlets.FlashServlet.doPost (FlashServlet.java:156)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)

    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)

    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)

    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)

    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)

    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)

    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)

    to org.apache.coyote.AbstractProtocol$ AbstractConnectionHandler.process (AbstractProtocol.java:611)

    to org.apache.tomcat.util.net.JIoEndpoint$ SocketProcessor.run (JIoEndpoint.java:316)

    to java.util.concurrent.ThreadPoolExecutor$ Worker.runTask (ThreadPoolExecutor.java:895)

    to java.util.concurrent.ThreadPoolExecutor$ Worker.run (ThreadPoolExecutor.java:918)

    to org.apache.tomcat.util.threads.TaskThread$ WrappingRunnable.run (TaskThread.java:61)

    at java.lang.Thread.run(Thread.java:662)

    Caused by: MITI.server.services.lineage.LineageException: (LNGTRC_E0016) SQL error during the tracing of lineage: ORA-22813: value of the operand exceeds the limits of the system

    at MITI.server.services.lineage.database.LineageDataSource.handle (LineageDataSource.java:41)

    at MITI.util.database.CommonDataSource.handleSQLException (CommonDataSource.java:124)

    at MITI.util.database.CommonDataSource.executeTransaction (CommonDataSource.java:83)

    at MITI.util.database.CommonDataSource.executeStatement (CommonDataSource.java:54)

    at MITI.server.services.lineage.impl.LineageImpl.traceLineage (LineageImpl.java:554)

    at MITI.server.services.lineage.common.LineageTracer.traceLineage (LineageTracer.java:1078)

    at MITI.server.services.lineage.common.LineageTracer.traceDataLineage (LineageTracer.java:313)

    at MITI.server.services.lineage.common.LineageTracer.traceTechnicalData (LineageTracer.java:176)

    at MITI.web.common.service.facades.LineageFacadeImpl.getLineageGraph (LineageFacadeImpl.java:245)

    ... 21 more

    Caused by: java.sql.SQLException: ORA-22813: value of the operand exceeds the limits of the system

    at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)

    at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)

    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:206)

    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)

    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)

    at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1035)

    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:194)

    at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:791)

    at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:866)

    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1188)

    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3386)

    at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3487)

    at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1374)

    at MITI.util.database.Query.executeStatement (Query.java:45)

    at MITI.util.database.Statement.execute (Statement.java:66)

    to MITI.util.database.CommonDataSource$ 1.run(CommonDataSource.java:50)

    to MITI.util.database.CommonDataSource$ 1.run(CommonDataSource.java:47)

    at MITI.util.database.Transaction.execute (Transaction.java:92)

    at MITI.util.database.CommonDataSource.executeTransaction (CommonDataSource.java:80)

    ... more than 27

    Caused by:

    MITI.server.services.lineage.LineageException: (LNGTRC_E0016) SQL error during the tracing of lineage: ORA-22813: value of the operand exceeds the limits of the system

    at MITI.server.services.lineage.database.LineageDataSource.handle (LineageDataSource.java:41)

    at MITI.util.database.CommonDataSource.handleSQLException (CommonDataSource.java:124)

    at MITI.util.database.CommonDataSource.executeTransaction (CommonDataSource.java:83)

    at MITI.util.database.CommonDataSource.executeStatement (CommonDataSource.java:54)

    at MITI.server.services.lineage.impl.LineageImpl.traceLineage (LineageImpl.java:554)

    at MITI.server.services.lineage.common.LineageTracer.traceLineage (LineageTracer.java:1078)

    at MITI.server.services.lineage.common.LineageTracer.traceDataLineage (LineageTracer.java:313)

    at MITI.server.services.lineage.common.LineageTracer.traceTechnicalData (LineageTracer.java:176)

    at MITI.web.common.service.facades.LineageFacadeImpl.getLineageGraph (LineageFacadeImpl.java:245)

    at MITI.flash.tabs.VizModelLineage.getLineageTree (VizModelLineage.java:429)

    at MITI.flash.tabs.VizModelLineage.buildLineageGraph (VizModelLineage.java:356)

    at MITI.flash.tabs.VizModelLineage.performAction (VizModelLineage.java:148)

    at MITI.server.servlets.FlashServlet.doPost (FlashServlet.java:156)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)

    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)

    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)

    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)

    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)

    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)

    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)

    to org.apache.coyote.AbstractProtocol$ AbstractConnectionHandler.process (AbstractProtocol.java:611)

    to org.apache.tomcat.util.net.JIoEndpoint$ SocketProcessor.run (JIoEndpoint.java:316)

    to java.util.concurrent.ThreadPoolExecutor$ Worker.runTask (ThreadPoolExecutor.java:895)

    to java.util.concurrent.ThreadPoolExecutor$ Worker.run (ThreadPoolExecutor.java:918)

    to org.apache.tomcat.util.threads.TaskThread$ WrappingRunnable.run (TaskThread.java:61)

    at java.lang.Thread.run(Thread.java:662)

    Caused by: java.sql.SQLException: ORA-22813: value of the operand exceeds the limits of the system

    at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)

    at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)

    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:206)

    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)

    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)

    at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1035)

    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:194)

    at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:791)

    at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:866)

    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1188)

    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3386)

    at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3487)

    at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1374)

    at MITI.util.database.Query.executeStatement (Query.java:45)

    at MITI.util.database.Statement.execute (Statement.java:66)

    to MITI.util.database.CommonDataSource$ 1.run(CommonDataSource.java:50)

    to MITI.util.database.CommonDataSource$ 1.run(CommonDataSource.java:47)

    at MITI.util.database.Transaction.execute (Transaction.java:92)

    at MITI.util.database.CommonDataSource.executeTransaction (CommonDataSource.java:80)

    ... more than 27

    Caused by:

    java.sql.SQLException: ORA-22813: value of the operand exceeds the limits of the system

    at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)

    at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)

    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:206)

    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)

    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)

    at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1035)

    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:194)

    at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:791)

    at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:866)

    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1188)

    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3386)

    at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3487)

    at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1374)

    at MITI.util.database.Query.executeStatement (Query.java:45)

    at MITI.util.database.Statement.execute (Statement.java:66)

    to MITI.util.database.CommonDataSource$ 1.run(CommonDataSource.java:50)

    to MITI.util.database.CommonDataSource$ 1.run(CommonDataSource.java:47)

    at MITI.util.database.Transaction.execute (Transaction.java:92)

    at MITI.util.database.CommonDataSource.executeTransaction (CommonDataSource.java:80)

    at MITI.util.database.CommonDataSource.executeStatement (CommonDataSource.java:54)

    at MITI.server.services.lineage.impl.LineageImpl.traceLineage (LineageImpl.java:554)

    at MITI.server.services.lineage.common.LineageTracer.traceLineage (LineageTracer.java:1078)

    at MITI.server.services.lineage.common.LineageTracer.traceDataLineage (LineageTracer.java:313)

    at MITI.server.services.lineage.common.LineageTracer.traceTechnicalData (LineageTracer.java:176)

    at MITI.web.common.service.facades.LineageFacadeImpl.getLineageGraph (LineageFacadeImpl.java:245)

    at MITI.flash.tabs.VizModelLineage.getLineageTree (VizModelLineage.java:429)

    at MITI.flash.tabs.VizModelLineage.buildLineageGraph (VizModelLineage.java:356)

    at MITI.flash.tabs.VizModelLineage.performAction (VizModelLineage.java:148)

    at MITI.server.servlets.FlashServlet.doPost (FlashServlet.java:156)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)

    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)

    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)

    Oracle has published OEMM 12.2.1 and this error is gone! So if you are facing this problem in an older version, just go to the newest one.

  • reload the page when SQL query returns a value

    Hello world

    the title of this discussion may seem strange, but I'll try to explain why I need this:

    A user has the ability to connect on my APEX application. There are several tabs in my application that are visible only if a certain SQL statement returns a value which is not the case by default. The user has also the ability to download a file that is transferred to an external system that analyzes the file and writes the data in the database. During this writing process - which may take several minutes - conditions for some of the tabs to show the will becomes real (-> the query will return a value). When the user refreshes the page manually, the tabs will be displayed. However, I want the tabs will appear automatically when the condition is met.

    Is it possible to refresh the page as soon as the query returns a value? It is perhaps possible to check it on the client side and trigger a refresh of the page when the condition is met. It would be even better if only the tabset has been updated, but refreshing the full page is fine as well.

    Thank you!

    Here is an overview of how it can be done

    This is possible thanks to a dynamic action being performed on a timer.

    View default tabs and dynamic action hide them on loading the page if they are not to be considered

    Create a dynamic action that will execute your query every 5 seconds or more

    If the query returns data, you can use the dynamic action to show your tabs using javascript

  • Question by adding the LOBs-ORA-06502: PL/SQL: digital error or value

    Hello

    I'm using Oracle 11 g.

    I have a requirement in which I need to add LOBs and I must insert the LOB in a table column. I am facing problem when the data exceeds certain limits. My program works like the following:

    (Please note that my program logic is given below, not the exact program)

    DECLARE

    final_html CLOB.
    int_html CLOB.
    v_str VARCHAR2 (32767).

    i the number: = 0;

    BEGIN


    DBMS_LOB.CREATETEMPORARY (lob_loc = > int_html, CACHE = > TRUE, hard = > dbms_lob.) CALL);
    DBMS_LOB.CREATETEMPORARY (lob_loc = > final_html, CACHE = > TRUE, hard = > dbms_lob.) CALL);
    DBMS_LOB. OPEN (int_html, DBMS_LOB. LOB_READWRITE);
    DBMS_LOB. OPEN (final_html, DBMS_LOB. LOB_READWRITE);
    dbms_output. ENABLE (1000000);


    FOR i 1,100 loop

    v_str: = "< b >" |
    "< style td =" "DRESSING: break-word" width = "50" > < font size = "2" > ' | "
    I have | ' < / police > < table > ' |
    "< /tr >";

    DBMS_LOB. WriteAppend (lob_loc = > int_html, amount = > LENGTH (v_str), BUFFER = > v_str);


    END LOOP;
    dbms_output.put_line (' the length of the int_html is :'||) DBMS_LOB. GetLength (int_html));

    dbms_output.put_line (' the int_html :'|| is int_html).

    final_html: = "< html >" | int_html | "< / html > ';
    dbms_output.put_line (' the final_html :'|| is final_html).



    EXCEPTION
    WHILE OTHERS THEN


    dbms_output.put_line(SQLCODE||) e -'|| SQLERRM);
    DBMS_LOB. CLOSE (int_html);
    DBMS_LOB. CLOSE (final_html);
    DBMS_LOB. FREETEMPORARY (int_html);
    DBMS_LOB. FREETEMPORARY (final_html);

    END;


    When the loop is made of lesser value, say FOR example, the loop i IN 1.10, the program works very well, but when the closure is done for values more I'm ' - 6502-ORA-06502: PL/SQL: digital error or value ' error message.

    Please help me solve this problem.

    Thanking you in advance.


    Kind regards
    Sri

    Can you please specify what environment you run this?

    I modified your code as follows

    The code executed successfully until the length has been<= 32767="" i.e="" (="" until="" for="" i="" in="">

    In addition, you must use the function APPEND to concatenate variables clob.

    Please check the maximum size by default for varchar2 or dbms_output in your server since you get the error for just the loop in the range (FOR i IN 1,100).

    And Yes, Siva comments are valid.

    DECLARE

    final_html CLOB.
    int_html CLOB.
    v_str VARCHAR2 (32767).

    i the number: = 0;

    BEGIN

    DBMS_LOB.CREATETEMPORARY (lob_loc-online int_html, CACHE-online TRUE, hard-online dbms_lob. CALL);
    DBMS_LOB.CREATETEMPORARY (lob_loc-online final_html, CACHE-online TRUE, hard-online dbms_lob. CALL);
    DBMS_LOB. OPEN (int_html, DBMS_LOB. LOB_READWRITE);
    DBMS_LOB. OPEN (final_html, DBMS_LOB. LOB_READWRITE);
    dbms_output. ENABLE (1000000);

    FOR i 1.1092 loop

    v_str: = '' ||
    '' ||
    I have | '' ||
    '';

    DBMS_LOB. WriteAppend (lob_loc-int_html, amount => (v_str), BUFFER LENGTH-online v_str online);

    END LOOP;

    dbms_output.put_line (' the length of the int_html is :'||) DBMS_LOB. GetLength (int_html));
    Start
    dbms_output.put_line (' the int_html :'|| is int_html).
    dbms_output.put_line (' the length of the int_html is :'||) DBMS_LOB. GetLength (int_html));
    exception when others then
    dbms_output.put_line(SQLCODE||) e -'|| SQLERRM);
    end;
    /*
    Start
    final_html: = ''|| int_html | »';
    dbms_output.put_line (' the final_html :'|| is final_html).
    exception when others then
    dbms_output.put_line(SQLCODE||) e -'|| SQLERRM);
    end; */

    EXCEPTION
    WHILE OTHERS THEN

    dbms_output.put_line(SQLCODE||) e -'|| SQLERRM);
    DBMS_LOB. CLOSE (int_html);
    DBMS_LOB. CLOSE (final_html);
    DBMS_LOB. FREETEMPORARY (int_html);
    DBMS_LOB. FREETEMPORARY (final_html);

    END;

    Published by: Gurnani houta July 29, 2011 03:11

    Published by: Gurnani houta July 29, 2011 03:14

  • Align the value apex_item.text

    How can I align the value apex_item.text on the right?
    The default value is left.
    I tried to set the alignment of the column as rigth without success.

    Use the p_attributes for apex_item.text parameter to create a style attribute:

    style="text-align: right;"
    
  • Before the process of pl/sql header to assign values to the elements on the page

    How can I assign values to the elements of a page based on the data structure returned by a pl/sql procedure in the front header process? I think execution of a pl/sql procedure based on a URL parameter value and then assign values to the page elements. Is this really possible using Apex 4.0.2? If so, how can it be done?

    Thank you

    Salome

    The question is not really clear. What kind of "data structure returned by a procedure from pl/sql? Please be much more accurate.

    For a data structure of PL/SQL such as records containing 2 elements (x and there) returned as output parameter for a procedure to be assigned to 2 items p1_x and p1_ypage, all that is necessary in the header before process is something like

    declare
    ...
      l_rec rec_type;
    ...
    begin
    ...
      the_proc(..., p_out => l_rec, ...);
    
      :p1_x := l_rec.x;
      :p1_y := l_rec.y;
    ...
    end;
    
  • Pushing the right aligned field value to the left

    Hi guys,.

    I have a question about good alignment. I have a form with legend and supposedly, points as filler for the space between the legend and the value. I can stalled right value and I replaced the space with points by program, but if the value is too long, the field is cutting values instead of the fill hole (making the left position as the anchor rather than upright.) IMO, if it's just aligned, the anchor point must be to the right instead of the left.

    Can someone help me with this problem? Thank you!!

    For example.


    subtitle 1:... Value1

    subtitle 1:... V1WWWWW < WW > (value obtained cut points overlaps with the legend)

    subtitle 1:... V1 (if the value is too short, there is space between the legend)

    PS: or if you can give a different approach in the empty space between the legend and the value of filling with dots, it is also a pts 10 suggestion if it works. Thank you!!!

    Not sure I can send you a sample that shows the number of

    [email protected] and I'll take a look.

    Paul

Maybe you are looking for