PL/SQL cursor loop... error IN the necessary clause... but several lines

Oracle 11 g 2 Linux x86_64

Hi all


I do turn the PL/SQL block below, but get the error below. I know, the INTO clause can be used only when a single line will be returned. In this case, I know that it returns multiple lines, so why he asked to use the INTO clause?

DECLARE

v_object VARCHAR2 (10): = "TABLE";

v_schema VARCHAR2 (30): = 'TEST ';

CURSOR tblsze_cur IS

SELECT table_name

FROM dba_tables

Owner WHERE = 'TEST '.

AND (IN) table_name

"T1"

"T2."

"T3");

BEGIN

FOR tbl_rec IN tblsze_cur

LOOP

Select * from

Table (dbms_space. OBJECT_GROWTH_TREND

(v_schema, tbl_rec.table_name, v_object)) ;

END LOOP;

END;

/

Select * from table (dbms_space. OBJECT_GROWTH_TREND

*

ERROR at line 21:

ORA-06550: line 21, column 3:

PLS-00428: an INTO clause in this SELECT statement

It would be something more like this (untested)...

Set serverout on

create type object_growth_trend_row as object)
validating TIMESTAMP,
space_usage NUMBER,
space_alloc NUMBER,
quality VARCHAR (20))
/

Create type object_growth_trend_table as table of the object_growth_trend_row
/

DECLARE
number of r;
We varchar2 (30): = 'SCOTT ';
TYPE nmtbl IS TABLE OF THE all_tables.table_name%TYPE;
tNom nmtbl;
tgrowth object_growth_trend_table;
CURSOR c1 IS
SELECT table_name
From all_tables
Owner WHERE we =
AND table_name in ('EMP', 'Department');
growth of cursor (tablename in varchar2) is
Select *.
table (dbms_space.object_growth_trend (tablename, 'TABLE'));
BEGIN
OPEN c1;
FETCH c1 COLLECT LOOSE tNom;
CLOSE c1;
BECAUSE me IN tNom. FIRST... tNom. LAST
LOOP
r: = 0;
dbms_output.put_line (' growth for table: ' | tname (i));
FOR g IN growth (tname (i))
LOOP
r: = r + 1;
dbms_output.put_line ('Timestamp: ' | g.timePoint |') Use: ' | g.space_usage);
END LOOP;
DBMS_OUTPUT. Put_line (' found lines: ' | r);
END LOOP;
END;
/

I just tested this in my SYS schema (although you should not create objects in SYS.)  and got...

For table growth: EMP

EXCEPTION in the treatment of the Charles - code:-14551 msg: ORA-14551: cannot perform a DML operation inside a query

Timestamp: 3 July 13 09.15.27.250000 use: 5332

Found lines: 1

For table growth: DEPT

EXCEPTION in the treatment of the Charles - code:-14551 msg: ORA-14551: cannot perform a DML operation inside a query

Timestamp: 3 July 13 09.15.27.282000 use: 4846

Found lines: 1

Not sure why it's up the DML operation... which seems inner exception to the dbms_space package.  Even if I just run it directly in sys like this:

SQL > SELECT *.
2. IN the TABLE (dbms_space.object_growth_trend ('SYS', ' $', TAB 'TABLE'));

AFTER SPACE_USAGE SPACE_ALLOC QUALITY
--------------------------------------------------------------------------- ----------- ----------- --------------------
3 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED


4 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
JULY 5, 13 09.19.01.956000 10342201 24117248 INTERPOLATED
6 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
7 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
8 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
9 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
10 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
JULY 11, 13 09.19.01.956000 10342201 24117248 INTERPOLATED
12 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
13 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
14 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
15 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
16 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
17 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
18 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
19 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
20 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
21 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
22 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
23 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
24 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
25 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
26 JULY 13 09.19.01.956000 10342201 24117248 GOOD
27 JULY 13 09.19.01.956000 10342201 24117248 GOOD
28 JULY 13 09.19.01.956000 10342201 24117248 GOOD
29 JULY 13 09.19.01.956000 10342201 24117248 GOOD
30 JULY 13 09.19.01.956000 10342201 24117248 GOOD
31 JULY 13 09.19.01.956000 10342201 24117248 GOOD
1ST AUGUST 13 09.19.01.956000 10342201 24117248 GOOD
2 AUGUST 13 09.19.01.956000 10342201 24117248 GOOD
3 AUGUST 13 09.19.01.956000 10342201 24117248 PLANNED
4 AUGUST 13 09.19.01.956000 10342201 24117248 PLANNED
5 AUGUST 13 09.19.01.956000 10342201 24117248 PLANNED
6 AUGUST 13 09.19.01.956000 10342201 24117248 PLANNED
7 AUGUST 13 09.19.01.956000 10342201 24117248 PLANNED

36 selected lines.

EXCEPTION in the treatment of the Charles - code:-14551 msg: ORA-14551: cannot perform a DML operation inside a query

... She still throws the exception.

Doesn't seem like a package of well designed if the types are provided only in the package and not as objects of database, which are required to be used in SQL based in pipeline.

Tags: Database

Similar Questions

  • Error in the COLMAP clause. Column name not found

    Hi guys,.

    I must be missing something simple here, but I can't understand it. I have a very simple test, I am trying to make. Remap the 1 table column in the other on replicat.

    I created the file defgens.
    *
    * Definitions created/modified 2013-02-12 13:08
    *
    * Description of the areas for each entry in the column:
    *
    * 1 name
    * Data type 2
    * 3 external length
    * Fetch 4 Offset
    * Level 5
    * 6 level
    * 7 null
    * 8 so strange bump
    * Inner length 9
    * 10 binary length
    * Length of the table 11
    * 12 most significant DT
    * 13 least significant DT
    * 14 high precision
    * 15 little specific
    * 16 point elementary
    * Occurs 17
    * Column 18 key
    * Data type of void 19
    *
    *
    Definition of table of BILLING. B1
    Length: 92
    SYSKEY: 0
    Columns: 2
    B_ID 64 50 0 0 0 1 0 50 50 50 0 0 0 0 1 0 1 2
    B_F_NAME 64 30 56 0 0 1 0 30 30 0 0 0 0 0 1 0 0 0
    End of definition
    *
    Definition of table of BILLING. B2
    Length: 92
    SYSKEY: 0
    Columns: 2
    B_ID 64 50 0 0 0 1 0 50 50 50 0 0 0 0 1 0 1 2
    B_L_NAME 64 30 56 0 0 1 0 30 30 0 0 0 0 0 1 0 1 0
    End of definition


    I installed the replicat read the sourcedefs and remap the columns

    -Identify the Replicat group:
    REPLICAT rxtest
    -State that the source and target definitions are identical:
    -ASSUMETARGETDEFS
    SOURCEDEFS /u12/oracle/golden_gate_11_rep/dirsql/defgen_billing.sql
    -Delete the installation program
    DISCARDFILE u12/oracle/golden_gate_11_rep/dirout/rxtest.txt, SERVING
    SETENV (NLS_LANG = 'AMERICAN_AMERICA. WE8MSWIN1252")
    -Specify the database connection information as needed for the database:
    GG username, password
    -Specify the error handling rules:
    REPERROR (BY DEFAULT, ABEND)

    DDL EXCLUDE ALL THE

    Billing.b1, billing.r1 of the TARGET CARD,
    () COLMAP
    B_ID = id,
    b_f_name = what);

    Now, when I try and start replicat rxtest I get this error in the report.

    Resolved CARD (entry of BILLING. (B1):
    THE CARD BILLING. B1, TARGET billing.r1, COLMAP (B_ID = id b_f_name = what);
    ... (B_ID = id b_f_name = what...)
    ^
    Error in the COLMAP clause. Column name not found.

    Any ideas? Thank you

    And the ranking of the column names in your clause of colmap? If that is not reversed?

  • I have a HP Pavilion a1700n it shows the necessary updates, but its does not download

    I have a HP Pavilion a1700n it shows the necessary updates, but its does not download

    There is a program that addresses this issue.  It's called the system update tool.   Please select the correct version.

    The original specifications of this computer is Vista 32 bit.

  • How to use the checkbox to select several lines of af: table

    Hi all
    I want to use the checkbox to select several lines of af: table

    Kind regards
    Tom

    Hello

    look at this link
    http://Sameh-Nassar.blogspot.com/2009/12/use-checkbox-for-selecting-multiple.html

    Kind regards
    Felix

  • Why Distributed Transaction error at the Message bean but not not Backing Bean?

    Hi guys,.

    * Update * I read the second post first.

    Using JDeveloper 12.1.2.0.0 and integrated WebLogic server of the same version.

    I have an ADF program where a draft of the application using JDBC in a message bean.  If I create an Application Module within the project and then sign in using its connection (java: comp/env/jdbc/MyAdfConnDS), then the code below works fine.  However, if I search connection JDBC (jdbc/MyJdbcDS), I have configured in WebLogic myself, then I distributed transaction errors.  How can I configure my JDBC connection to imitate the one who creates the AppModule?  This way I can run prepared explicitly stated and validation of the call?

    Here is my code JDBC

            conn.setAutoCommit(false);
            PreparedStatement statement = conn.prepareStatement(sql);
            statement.setLong(1, companyAccountId);
    // errors here
            statement.execute();
            conn.commit();
            statement.close();
    
    
    

    Which results in the error

    // prepared statement.
    DELETE BUSINESS_PARTNERS WHERE MASTER_TYPE_KEY = 'C' AND COMPANY_ACCOUNT_ID = ?
    java.sql.SQLException: Cannot call commit when using distributed transactions
                at weblogic.jdbc.wrapper.JTAConnection.commit(JTAConnection.java:373)
                at com.sample.myProduct.jms.clients.MyClient.deleteEntities(MyClient.java:211)
                at com.sample.myProduct.jms.clients.MyClient.importData(MyClient.java:155)
                at com.sample.myProduct.jms.beans.ImportMessageBean.onMessage(ImportMessageBean.java:91)
                at weblogic.ejb.container.internal.MDListener.execute(MDListener.java:575)
                at weblogic.ejb.container.internal.MDListener.transactionalOnMessage(MDListener.java:477)
                at weblogic.ejb.container.internal.MDListener.onMessage(MDListener.java:375)
                at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:4855)
                at weblogic.jms.client.JMSSession.execute(JMSSession.java:4529)
                at weblogic.jms.client.JMSSession.executeMessage(JMSSession.java:3976)
                at weblogic.jms.client.JMSSession.access$000(JMSSession.java:120)
                at weblogic.jms.client.JMSSession$UseForRunnable.run(JMSSession.java:5375)
                at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:550)
                at weblogic.work.ExecuteThread.execute(ExecuteThread.java:295)
                at weblogic.work.ExecuteThread.run(ExecuteThread.java:254)
    
    
    

    Here is a screenshot of all the available drivers: www.williverstravels.com/JDev/Forums/Threads/3544909/drivers.png, as well as the configuration of the transaction screen www.williverstravels.com/JDev/Forums/Threads/3544909/config.png

    I've tinkered enough to feel quite strongly, it is not an error in coding, but rather something in Weblogic.  I read what I can, but I don't know how the AppModule creates connections.  I would not add an AppModule just to retrieve its data source / login information if I don't.

    Ideas?

    Obviously, your message bean is configured to participate in a global transaction (for example, a JTA transaction). It is a behavior of the default message bean, even if you have not explicitly configured. When you get and use a JDBC connection in your message bean, this connection is attached to and participates in the overall transaction message bean (because you used compatible driver Oracle XA, it is seen on the 1st screenshot in your post), so you cannot perform local validation on the JDBC connection.

    Commit / rollback in this case can only be performed on the overall transaction (if the message bean is configured with the transactions managed by container) to be automatically or manually on the UserTransaction object (if the message bean is configured with bean-managed transactions). In other words, you must remove the conn.commit () statement, which is erroneous and obsolete when it is used in your message bean. If the message bean uses transactions managed by container, the container will commit / rollback automatically at the end of the method all the resources involved in the overall transaction (including your JDBC connection). If the method completed successfully (without exception), a validation will be performed. If the method fails (i.e., it ends with an exception), a cancellation will be made. If the message bean uses bean-managed transactions, the transaction is committed/restored when you explicitly call UserTransaction.commit () or UserTransaction.rollback ().

    The code above worked in a managed bean because JSF, ADF BC or ADF Faces applications require and participate in JTA transactions, then your JDBC connection has not been attached to a global transaction and you were able to perform local validation on the JDBC connection.

    You have two options to solve the problem. It depends on if you want your operations of JDBC to be in a global transaction with the bean of the message itself and its other actions or not. If they must be in a global transaction, then just remove the conn.commit () statement from your code. If they shouldn't be in a global transaction, you must either configure the message bean not to participate in global transactions or to configure the data source to use the «of the (thin) Oracle driver...» "instead of"Oracle (XA Thin)... driver. " ». (Remember to score the DataSource DO NOT to participate in a global transaction in the 2nd page of the data source configuration dialog in the management of WLS Console).

    NB. I highly recommend that you keep the global transactions. If you choose not to use a global transaction, it can happen that you committed the JDBC operations but an exception that happens after that, so the JMS message is not removed from the queue of messages and it will be processed after that, which causes the same operations of JDBC to be played and committed twice which must be avoided.

    Dimitar

  • Try to download inDesign CS5. When I click on download and serial line, I get an error message that there was an error recover the account. Tried several times, same problem.

    Try to download inDesign CS5. When I click on downloads and password I get an error message that says error during the file extraction.

    Try to download CS5 from this page instead: Download Adobe Creative Suite 5 products

  • SQL Loader in error after the modified table

    Hello

    "I had a column in the table that was initially defined as VARCHAR2 (250), I changed the table and made 1000, when the data is over 250 characters sql loader is in error"

    Field in the data file exceeds the maximum length. The table shows the field in VARCHAR2 (1000). Help, please.

    Thank you

    Gwenaël

    I changed the table again to make VARCHAR2 (4000) and still have the error. My data are about 350 characters. Help, please

    Change to the column sqlldr control file and explicitly set tank (4000).  The default data in sqlldr type is char (255).

  • SELECT LIST throws an error for the WHERE CLAUSE

    Hi all

    I am struck with what looks like a trivial mistake, but I don't know how he moved. I'm new to Apex (3.1). I'm experimenting with. I have Oracle 10 g on Windows.

    I have a drop-down list item in one of my pages (SELECTION list). I'm trying to display a few items he dynamically (depending on the logged-in user). I've defined this SELECT LIST and entered into the following query in "list of values".
    select enrolled_course display_value, course_id return_value 
    from COMP_LIST
    where stu_id = :APP_USER
    order by 1
    I got the following error.
    1 error has occurred
    LOV query is invalid, a display and a return value are needed, the column names need to be different. If your query contains an in-line query, the first FROM clause in the SQL statement must not belong to the in-line query.
    Then I tried the step by step instructions of "Oracle® Application Express Advanced Tutorials-version 3.1.2 - E10497-02. With the help of creating list of values such as creating separately. That too, I got the same error.

    I'm doing it wrong I suppose. Please correct me. Thanks in advance

    Regarding
    Guru

    Published by: guru Perrin on October 16, 2008 17:12

    Hello

    The principle should be the same. The value of the text element would be stored in the session, then you can use: P1_APP_USER (or what is called the element) instead of: APP_USER. To be absolutely certain, you can create a page process to fill the element having the value of APP_USER point process before conditional header field is null. Or you could create a component of demand that populate once the connection and then use it everywhere where you have - I tend to do something like this with user-specific information that is stored in my tables from the user.

    Andy

  • Reference SQL Loader Bind Variables in the when Clause

    Support for SQL: SQL * Loader: version 8.0.6.3.0 (don't ask, it runs on Oracle EBS 11i...)

    I have a case where my sample data looks like:
    HD00100001002
    SM00100002CHAPS   99999999999                     20120906GBP0000000000001000000000001
    and another file
    HD00100001001
    SM00100002GBP0000000000001000000000001
    Essentially, I need to apply another "IN" clause for each record of SM depends on the ack_type (char 13 on HD recording), either 1 or 2

    I tried setting up the ack_type with a variable binding but find how to reference.

    Example of control file:
    --  $Header: test.ctl
    --
    
    LOAD DATA
    REPLACE
    
    -- Record Type HD : File Header
    INTO TABLE  test_table
    WHEN rec_id_no = 'HD'
    TRAILING NULLCOLS
    (rec_no                 RECNUM,
     hdr_line               CONSTANT 'H',
     rec_id_no              POSITION(1:2)   CHAR,
     file_number            POSITION(3:5)   CHAR,
     sequence_number        POSITION(6:10)  CHAR,
     status                 POSITION(11:12) CHAR,
     ack_type               POSITION(13:13) ":ack_type",
     co_id                  POSITION(14:21) CHAR,
     dept_id                POSITION(22:24) CHAR,
     btch_no                POSITION(25:36) CHAR,
     trans_id               POSITION(37:42) CHAR)
    
    -- Record Type SM : File Summary
    INTO TABLE test_table
    WHEN rec_id_no = 'SM' and :ack_type = '1'
    TRAILING NULLCOLS
    (rec_no                 RECNUM,
     hdr_line               CONSTANT 'L',
     rec_id_no              POSITION(1:2)   CHAR,
     file_number            POSITION(3:5)   CHAR,
     sequence_number        POSITION(6:10)  CHAR,
     ccy_code               POSITION(11:13) CHAR,
     amount                 POSITION(14:26) CHAR,
     number_trans_ok        POSITION(27:40) CHAR)
    The code above does not work, it is said that: ack_type is not recognized. Is there a way to do it, given the former character of the SQL Load version?

    What is the database version 11i is running on? If 11 GR 2, this doc can help you in the use of the features that Dan mentions

    How to use the 9i or 10g features in SQL * Loader for Apps? [423035.1 ID]

    HTH
    Srini

  • Software Adobe acrobat reader always displays the necessary update, but there is none

    When I run a check of my modules, I always get a message of update of the Adobe acrobat reader software, but there is no update available

    For some reason Adobe any does always have the latest version of Adobe Reader on its download page. I suggest to use the internal update within Adobe Reader DC Auditor:

    Help > check for updates

    Or you can use this reference page:

    https://helpx.Adobe.com/Acrobat/release-note/release-notes-Acrobat-Reader.html

  • During installation I get a box pop up with key that says that I don't have the necessary permissions, but I am the Admin

    Hello
    I get a pop up box that says: I don't have enough permissions to use all the features of the program that I'm going to run it. You can run this program as a different user or continue to run the program as long as the current user. So I continue and then nothing happening no messages or anything. just nothing.

    Check that you are not Firefox running as administrator.

    Right click on the desktop Firefox shortcut and choose "Properties".

    Make sure that all items are disabled in the tab "Compatibility" in the Properties window.

    • Privilege level: "Run this program as Administrator" should not be selected
    • "Run this program in compatibility mode for:" must not be selected
  • calculate the time difference between several lines

    Hello

    I have a table as below:

    create table select TEST_CASETBL (ID, CASE_NUM, CASE_STATUS, CASE_SUB_STATUS, LAST_UPD_DTTM)

    112, 123-456', 'open', 'Work', TO_DATE (11 March 2015 13:00 ',' dd/mm/yyyy hh24:mi:ss') of the DUAL union all select

    113, 123-456', 'Open', 'pending on the admin', TO_DATE (10 January 2015 15:00 ',' dd/mm/yyyy hh24:mi:ss') of the DUAL union all select

    114, 123-456', 'Open', 'client expectation', TO_DATE (10 July 2015 09:00 ',' hh24:mi:ss' of dd/mm/yyyy) of the DUAL union all select them

    315, 123-456', 'open', 'Work', TO_DATE (September 15, 2015 10:00 ',' dd/mm/yyyy hh24:mi:ss') of the DUAL union all select

    219, 123-456', 'Open', 'pending on the admin', TO_DATE (January 9, 2015 08:00 ',' dd/mm/yyyy hh24:mi:ss') of the DUAL union all select

    651, 123-456', 'open', 'Work', TO_DATE (August 20, 2015 10:00 ',' dd/mm/yyyy hh24:mi:ss') from DUAL;

    I would like to calculate the duration total (days ideally) to CASE_SUB_STATUS, so have a set of lines:

    CASE_NUM of work waiting on admin waiting on customer

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

    123-456 70days 6 hours

    Here is the explanation of the pattern:

    ex: for everyday business computing (timestamp timestamp of ID:651 - ID:219) +(timestamp of ID:315-timestamp of ID:114) + (ID:112 stamp - current_time) = 11 days + 21 days 22hrs 23hrs 36 days 9 hours

    still waiting on admin

    (ID:219 timestamp - timestamp of ID:315) + (ID:113 timestamp - timestamp of ID:112)

    still waiting on the client

    (ID:114 timestamp - timestamp of ID:113)

    I would appreciate any idea how to solve this, ideally as an SQL

    Thank you

    Should he not?...

    with test_casetbl (id, case_num, case_status, case_sub_status, last_upd_dttm) as)

    Select 112, 123-456', 'Open', 'Work', TO_DATE (11 March 2015 13:00 ',' dd/mm/yyyy hh24:mi:ss') of all the DOUBLE union

    Select 113, 123-456', 'Open', 'pending on the admin', TO_DATE (10 January 2015 15:00 ',' dd/mm/yyyy hh24:mi:ss') of all the DOUBLE union

    Select 114, 123-456', 'Open', 'client expectation', TO_DATE (10 July 2015 09:00 ',' dd/mm/yyyy hh24:mi:ss') of all the DOUBLE union

    Select 315, 123-456', 'Open', 'Work', TO_DATE (September 15, 2015 10:00 ',' dd/mm/yyyy hh24:mi:ss') of all the DOUBLE union

    Select 219, 123-456', 'Open', 'pending on the admin', TO_DATE (January 9, 2015 08:00 ',' dd/mm/yyyy hh24:mi:ss') of all the DOUBLE union

    Select 651, 123-456', 'Open', 'Work', TO_DATE (August 20, 2015 10:00 ',' the hh24: mi: ss' dd/mm/yyyy) double

    ),

    t like)

    Select case_num,

    case_sub_status,

    (last_upd_dttm, 1, sysdate) ahead of diff last_upd_dttm (partition by order of last_upd_dttm case_num).

    of test_casetbl

    )

    Select case_num,

    trunc (a) | "day (s). TO_CHAR (date ' 1-1-1' + a, "fmhh24" 'mi' minute (s) "ss" second (s) hour (s)"") "work."

    trunc (b) | "day (s). TO_CHAR (day 1-1-1' + b, "fmhh24" 'mi' minute (s) "ss" second (s) hour (s)"") 'Waiting on admin',

    trunc (c) | "day (s). TO_CHAR (day 1-1-1' + c, "fmhh24" 'mi' minute (s) "ss" second (s) hour (s)"") "waiting on customer."

    t

    pivot)

    Sum (diff)

    for case_sub_status in)

    'Work' is.

    B "waiting on admin',

    C "customer expectation."

    )

    )

    CASE_NUM Working Waiting on admin Waiting on customer
    123-456 63 day (s) 22 hour (s) (s) 50 minute 49 second (s) 19 day (s) on 20 (s) hour 0 minute 0 second (s) 27 day (s) on 4 hour (s) 0 minute 0 second (s)
  • How to use the checkbox to update several lines

    Hi all

    I'm new to apex and I have a problem now. I find this code somewhere:

    BEGIN

    FOR I IN 1... APEX_APPLICATION. G_F01. COUNTING LOOP

    REMOVE FROM THE ASER

    WHERE ID = TO_NUMBER (APEX_APPLICATION. G_F01 (I));

    END LOOP;

    END;

    It can remove selected items, now I want to make some modifications to it.

    I want to update some columns when I ticked the box. How to make this change? I mean, like this:

    UPDATE ASER SET STATUS = '1' when I selected items

    Can you help me? Thank you!

    Hello

    I don't know exactly what you want to do, but if I am guessing right then of course you want updated also based on the elements of the selected check box.

    
    BEGIN
     FOR I IN 1 .. APEX_APPLICATION.G_F01.COUNT LOOP
    
       DELETE FROM ASER
      WHERE ID=TO_NUMBER(APEX_APPLICATION.G_F01(I)) ;
    UPDATE APSER
    SET STATUS = 1
    WHERE ID=TO_NUMBER(APEX_APPLICATION.G_F01(I)) ;
       END LOOP;
    
      END;
    

    But if not and you try rather to use these values to update another table after Session State is the way to go.

    Kind regards

    Benjamin.

  • Insert the statement with the subquery to insert several lines

    Hi friends,

    Please find below mentioned query and error. Also suggest me to go forward.

    SQL > INSERT INTO FM_TRAN_DOC_NO (TDOC_COMP_CODE,

    2 TDOC_TRAN_CODE,

    TDOC_ACNT_YEAR 3,.

    TDOC_CUR_NO 4,.

    TDOC_MAX_NO 5,.

    TDOC_CAL_YEAR 6,.

    TDOC_PERIOD 7,.

    TDOC_DIVN_CODE 8,.

    TDOC_DEPT_CODE 9,.

    TDOC_CR_UID 10,

    TDOC_CR_DT 11,

    TDOC_UPD_UID 12,

    13 TDOC_UPD_DT)

    14 SELECT '001',

    15 (SELECT DISTINCT FM_TRAN_DOC_NO TDOC_TRAN_CODE

    16               '6',

    17               '0',

    18 '9999',

    19 NULL,

    20 NULL,

    21 NULL,

    22 NULL,

    23 "AGT,"

    24 TO_DATE (SYSDATE),

    25 NULL,

    26 TO_DATE (SYSDATE) FROM DUAL;

    (SELECT DISTINCT FM_TRAN_DOC_NO TDOC_TRAN_CODE),

    *

    ERROR on line 15:

    ORA-01427: einreihig subquery returns multiple rows

    +Untested.

    When values except 'TDOC_TRAN_CODE' are hardcoded, there is no need to select double.

    Something like that?

    INSERT INTO FM_TRAN_DOC_NO)

    TDOC_COMP_CODE,

    TDOC_TRAN_CODE,

    TDOC_ACNT_YEAR,

    TDOC_CUR_NO,

    TDOC_MAX_NO,

    TDOC_CAL_YEAR,

    TDOC_PERIOD,

    TDOC_DIVN_CODE,

    TDOC_DEPT_CODE,

    TDOC_CR_UID,

    TDOC_CR_DT,

    TDOC_UPD_UID,

    TDOC_UPD_DT

    )

    SELECT DISTINCT

    '001',

    TDOC_TRAN_CODE,

    « 6 »,

    '0',

    "9999",

    NULL,

    NULL,

    NULL,

    NULL,

    "AGT,"

    TO_DATE (SYSDATE),

    NULL,

    TO_DATE (SYSDATE)

    OF FM_TRAN_DOC_NO;

  • Calculation of the time differences between several lines

    Hello

    I have a table as below:

    EVENT ID DATE
    1. start 05/03/2012-13:00
    1. stop the 15:00 05/04/2012
    1. start 09:00 05/07/2012
    1 stop on 05/09/2012 10:00
    Start 2 08/06/2012-08:00
    2 stop on 08/07/2012 10:00

    I would like to calculate the duration (in hours ideally) between 'Start' and 'Stop' for each ID, so having a set of lines:

    ID TimeSpan
    ---------------------
    1 75
    26 2

    I would appreciate any idea how to solve this, ideally as a SQL solution or maybe a function.

    Thank you very much!
    Tom

    The difference between two dates is a number, where 1 = 1 day. Multiply by 24 to get hours.

    Use the LAG, as stated above, to compare the date prior to the current date.

    create table T(TID, EVENT, TDATE) as select
    1, 'start', TO_DATE('03/05/2012 13:00:00', 'dd/mm/yyyy hh24:mi:ss') from DUAL union all select
    1, 'Stop',  TO_DATE('04/05/2012 15:00:00', 'dd/mm/yyyy hh24:mi:ss') from DUAL union all select
    1, 'start', TO_DATE('07/05/2012 09:00:00', 'dd/mm/yyyy hh24:mi:ss') from DUAL union all select
    1, 'Stop',  TO_DATE('09/05/2012 10:00:00', 'dd/mm/yyyy hh24:mi:ss') from DUAL union all select
    2, 'start', TO_DATE('06/08/2012 08:00:00', 'dd/mm/yyyy hh24:mi:ss') from DUAL union all select
    2, 'Stop',  TO_DATE('07/08/2012 10:00:00', 'dd/mm/yyyy hh24:mi:ss') from DUAL;
    
    select tid, round(sum(hours)) hours from (
      select case
        when EVENT = 'Stop' then 24*(TDATE - LAG(TDATE) over(partition by TID order by TDATE))
        else 0 end hours,
      TID from T
    )
    group by tid;
    
    TID HOURS
    --- -----
      1    75
      2    26
    

Maybe you are looking for

  • USB boot on the Satellite 2180 CDT

    Hi allCan someone help me on how can I boot from USB HDD?My HARD drive is damaged so I can't run any OS from him. & Actually I don't want to buy a new HARD drive.So I want to boot from my USB HDD.The most recent machine BIOS contains a boot USB menu.

  • Windows 7 USB/MIDI Device Complications

    Hello, I have a question about how Windows 7 handles the USB/MIDI input. Recently, I had just bought a new Controller of Keytar USB/MIDI Alesis Vortex and decided to plug it into my computer to run the Software Patch and Virtual Software Instruments

  • Crypto pki authenticate ca

    people I am trying to configure a vpn site-to site between 1900 routers by using certificates to authenticate peer I copied in the root CA certificate, produced CSR and now have the certificate server/router Once I have stick it in the router cannot

  • Clientless VPN bookmark login page

    I have a customer site using SSL - VPN without customer with a number of connection profiles that are used depending on the type of user, i.e. the administrative user, sales, marketing, consulting, etc. For security reasons, the client has chosen to

  • Go live - invited to provide details to create a "record."

    I don't know where to post this question, so please forgive me if I chose the wrong forum.I have a client who has an old site with their own website hosting and email hosting.They want to continue to use their current by email once we go live with BC