SQL for the synchronous question of AIR vs. asynchronous

Gidday guys

I've implemented a SQLite database that will be processing up to 150 000 lines at the same time.  I use parametized queries, wrapped in a transaction, it should be fast enough. I use asynchronous methods.

I put the motions and managed to get a static test of query in the database using the parameters.  Wahooo!

However, now I did it dynamic to receive bulk data, I get the error:

"Operation could not be performed SQLStatement.executing is true.

I wonder if anyone can

(a) suggest that synchronous may be a better option

or

(b) guide me as to what order the functions and event listeners would fix my follows established...

THE PROCESS:

-J' have a lot of file names in an array, that need to be tweaked before thrown into the database

-J' set up the sql (leg work done earlier) connection, the query statement, and then start a transaction:

insertStmt.sqlConnection = conn;

insertStmt.text = "INSERT or IGNORE INTO tester3 VALUES (@col1, @col2);

Conn.Begin ();

-table is thrown into a function that starts an enterFrame iteration (if the display does not freeze), where I change the names of files, and put each file name twisted and other (also directed for the database) data in an object and deliver it to the function that prepares the data in the settings...

prepareParameters ({col1:col1var, col2:col2var});})

prepareParameters(row:Object):void

{

[insertStmt.parameters["@col1"] = row.col1;

[insertStmt.parameters["@col2"] = row.col2;

insertStmt.execute ();
}

-at the end of the loop table, call the transaction end function

I think the problem is that the loop sends the next object to prepareParameters() until the database has finished executing the last insert statement.

I tried to configure a listener for results to try to make Flash do not return to the loop until the listener received something, but I get the same error.

My first thought was "Hey, shouldn't Flash wait until after insertStmt.execute ();" has finished before returning to the loop that calls its function? But maybe this happens in synchronous treatment?

Thanks for your thoughts guys.

Before I head to a few races a couple quick notes.

If you just want a quick number of items affected in the database across all executions altogether (although SQLConnection is maintained), you can use this property:

http://help.Adobe.com/en_US/FlashPlatform/reference/ActionScript/3/Flash/data/SQLConnectio #totalChanges n.html

To be more practical, SQLResult can be used on a SQLStatement instance after it is over (after the RESULT event). If you do not want to use it (as in the example above) in the manager function, _runQuery. The SQLEvent sent to method (apart from the first _runQuery (null)) will contain a reference to the SQLStatement instance that has been run. You can see me access it explicitly to remove the handler from the success of it as follows:

If (e)

{

SQLStatement (e.taget) .removeEventListener (SQLEvent.RESULT, _runQuery);

}

Which is simply check to see if I have a valid (non-null) event sent to the method and if yes I use it to remove the handler. I could use a weak reference in the event handler, but on devices, I would be extremely explicit in removing all memory that I absolutely is useless as soon as possible.

That said, each SQLStatement has getResult() method:

http://help.Adobe.com/en_US/FlashPlatform/reference/ActionScript/3/Flash/data/SQLStatement .html #getResult ()

That method contains the method, you asked:

http://help.Adobe.com/en_US/FlashPlatform/reference/ActionScript/3/Flash/data/SQLResult.ht ml #rowsAffected

It's just the number of rows affected by your last statement (UPDATE, INSERT, DELETE,...). If you want to follow him through multiple SQLinstructions you could do a new class var to collect the results, if you do not use SQLConnection totalChanges I linked above:

If (e)

{

get an official reference

var insertStmt:SQLStatement = (e.target) SQLStatement;

results of this execution

var result: SQLResult = insertStmt.getResult ();

draw some properties of an "INSERT" as you do

trace ("Insert ID:" + result.lastInsertRowID + ", affected rows:" + result.rowsAffected);

If you perform the UPDATE/DELETION there are .data with an array property

all the results that you can browse, exhausted for example length of results

(just treat it as type Array and iterate over it if you wish)

trace ("result Total SQL statements:" + result.data.length);

remove the listener

insertStmt.removeEventListener (SQLEvent.RESULT, _runQuery);

}

Keep in mind, it's TO-achieve, not a total. This allows you to review the results of each "single" execute() that you are running. You can search for questions or to check the validity of the data, etc., on each function execute(). If you don't really care that then just check the _sqlConn.totalChanges for one number for everything that moved the database runs.

Don't forget to close the connection of _sqlConn after all function execute() statements look the next time you run queries, it resets the totalChanges. Also on something like a DELETION * a SQLResult returned 0 results. It is mentioned in the documentation, read paragraph 3 on the addition of a 'WHERE 1 = 1' just to get results to fill:

http://help.Adobe.com/en_US/FlashPlatform/reference/ActionScript/3/Flash/data/SQLResult.ht ml #rowsAffected

Tags: Adobe Animate

Similar Questions

  • The title of the TOC for the random question slides

    I want to create a quiz that randomly pulls a pool of questions.  I think I know how to do that (rightly), but when I do, the table of contents is only show (title "Slide") the name/title of the question slide to chance itself, which is not really give any useful information.  I wonder if there is a way to show rather the title of the question which is selected (and present) of the random question slide.  This, in my opinion, would be much more useful to users taking the quiz.  Is there a known way to get there?  Thank you!

    Capture.PNG

    Project files cannot be attached to these messages in the forum.

    Lilybiri has already answered your question.  The table of contents only shows the name of the random Question slide and can't give you the name of the slide of the random quiz question slide that is picked up from the Question pool when running dynamically.

    Essentially the Random Question slide is just a placeholder.

    However, I think that your idea of being able to have the selected slide display its name in the table of contents if you wish has some merit.  Then I suggest that you connect to an enhancement with Adobe for this request.  You never know...

  • SQL for the webADI fields

    Hello

    I need a SQL to retrieve the fields and another piece of land to show if it is a line or a header for the WebADI project.

    Can someone provide me with this SQL if you have already worked on it?

    Thank you and best regards,

    Yuvraj

    SELECT DISTINCT fap.application_short_name 'Application Short Name',

    bib.User_Name "integrating user name."

    BLB.user_name "name of the page layout."

    bicb.interface_col_name "name of the field."

    blbb.user_name 'investment. "

    BLC. Default_value 'Default Value ',.

    UPPER CASE (NVL (blc.default_type, 'NONE'))

    WHEN 'NONE', THEN 'none'

    WHEN "FORMULA", THEN "Formula".

    WHEN 'CONSTANT' THEN 'constant '.

    WHEN 'PARAMETER' THEN 'setting '.

    WHEN 'SQL' THEN 'SQL '.

    WHEN 'ENVIRONMENT' THEN 'environment '.

    ANOTHER "UNKNOWN".

    END

    'The Type by default'

    OF apps.fnd_application fap.

    Apps.bne_integrators_vl bib,

    Apps.bne_layouts_vl blb,

    Apps.bne_layout_blocks_tl Boop,

    Apps.bne_layout_cols blc,

    Apps.bne_interface_cols_b bicb,

    Apps.bne_components_b bcb,

    Apps.bne_param_lists_b bplb,

    Apps.bne_param_list_items bpli

    WHERE 1 = 1

    AND fap.application_id = bib.application_id

    -bne_integrators_b | bne_layouts_b

    AND bib.integrator_code = blb.integrator_code

    AND bib.application_id = blb.integrator_app_id

    -bne_layouts_b | bne_layout_blocks_b

    AND blb.layout_code = blbb.layout_code

    AND blb.application_id = blbb.application_id

    -bne_layout_blocks_b | bne_layout_cols

    AND blbb.layout_code = blc.layout_code

    AND blbb.application_id = blc.application_id

    AND blbb.block_id = blc.block_id

    -bne_layout_cols | bne_interface_cols_b

    AND blc.application_id = bicb.application_id

    AND blc.interface_code = bicb.interface_code

    AND blc.sequence_num = bicb.sequence_num

    -bne_interface_cols_b | bne_components_b

    AND bicb.application_id = bcb.application_id

    AND bicb.val_component_code = bcb.component_code

    -bne_components_b | bne_param_lists_b

    AND bcb.param_list_code = bplb.param_list_code

    -bne_param_lists_b | bne_param_list_items

    AND bplb.param_list_code = bpli.param_list_code

    AND blbb.language = 'en '.

    AND fap.application_short_name = 'PA '.

    ORDER BY 1, 2;

  • How the group using SQL for the desired output.

    Hi all

    I am currently using oracle 10.2.0.4.0

    Create a table script:
    CREATE TABLE FORTEST
    ( gpno VARCHAR2(10 BYTE),
      classnumber  VARCHAR2(10 byte),
      age_min NUMBER,
      age_max NUMBER,
      amount NUMBER)
    INSERT statement:
    insert into fortest  (GPNO,classnumber,age_min,age_max,amount) values
    ('G123' , 01,0,29,1) 
    insert into fortest  (GPNO,classnumber,age_min,age_max,amount) values
    ('G123' , 01,30,35,2) 
    insert into fortest  (GPNO,classnumber,age_min,age_max,amount) values
    ('G123' , 01,36,40,3) 
    insert into fortest  (GPNO,classnumber,age_min,age_max,amount) values
    ('G123' , 02,0,29,1) 
    insert into fortest  (GPNO,classnumber,age_min,age_max,amount) values
    ('G123' , 02,30,35,2) 
    insert into fortest  (GPNO,classnumber,age_min,age_max,amount) values
    ('G123' , 02,36,40,5) 
    insert into fortest  (GPNO,classnumber,age_min,age_max,amount) values
    ('G123' , 03,0,29,1) 
    insert into fortest  (GPNO,classnumber,age_min,age_max,amount) values
    ('G123' , 03,30,35,2) 
    insert into fortest  (GPNO,classnumber,age_min,age_max,amount) values
    ('G123' , 03,36,40,3) 
    insert into fortest  (GPNO,classnumber,age_min,age_max,amount) values
    ('G124' , 01,0,29,1) 
    insert into fortest  (GPNO,classnumber,age_min,age_max,amount) values
    ('G124' , 01,30,35,2) 
    insert into fortest  (GPNO,classnumber,age_min,age_max,amount) values
    ('G124' , 01,36,40,3) 
    power required:
    gpno    classnumber    age_min    age_max    amount
    G123    1,3                0        29        1
    G123    1,3                30       35        2
    G123    1,3                36       40        3
    G123    2                  0        29        1
    G123    2                  30       35        2
    G123    2                  36       40        5
    G124    1                  0        29        1
    G124    1                  30       35        2
    G124    1                  36       40        3
    as for gpno g123, classnumber 1 and 3, the rates are the same in all the age_min and age_max they need to be grouped.
    even if gpno 123 classnumber 2 has the same rates as the classesnumber 1 and 3 for the age groups 0 to 29 and 30 to 35,
    rates are different for ages 36 to 40. so it should not be placed together. How can I do this in SQL

    any help is appreciated.

    Thanks in advance.

    Hello

    Thorny problem!

    Unfortunately, LISTAGG was created to the Oracle 11.2. About half of the complexity here is the aggregation of chain, i.e. forming the list of the classnumbers, as '1.3', using only functions available in Oracle 10.2.

    Here's a solution:

    WITH     got_gpno_classnumber_cnt   AS
    (
         SELECT     gpno, classnumber, age_min, age_max, amount
         ,     COUNT (*) OVER ( PARTITION BY  gpno
                                      ,            classnumber
                          )   AS gpno_classnumber_cnt
         FROM    fortest
    --     WHERE     ...     -- If you need any filtering, this is where it goes
    )
    ,     pairs          AS
    (
         SELECT    a.gpno
         ,       a.classnumber
         ,       MIN (b.classnumber)
                    OVER ( PARTITION BY  a.gpno
                              ,                    a.classnumber
                      )     AS super_classnumber
         FROM       got_gpno_classnumber_cnt  a
         JOIN       got_gpno_classnumber_cnt  b  ON   a.gpno     = b.gpno
                                      AND  a.age_min     = b.age_min
                                    AND  a.age_max     = b.age_max
                                    AND  a.amount     = b.amount
                                    AND  a.gpno_classnumber_cnt
                                            = b.gpno_classnumber_cnt
         GROUP BY  a.gpno
         ,            a.classnumber
         ,       b.classnumber
         HAVING       COUNT (*)     = MIN (a.gpno_classnumber_cnt)
    )
    ,     got_rnk          AS
    (
         SELECT DISTINCT
                 gpno, classnumber, super_classnumber
         ,     DENSE_RANK () OVER ( PARTITION BY  gpno
                                   ,                    super_classnumber
                                   ORDER BY          classnumber
                           )         AS rnk
         FROM    pairs
    )
    ,     got_classnumbers     AS
    (
         SELECT     gpno, classnumber, super_classnumber
         ,      SUBSTR ( SYS_CONNECT_BY_PATH (classnumber, ',')
                       , 2
                     )     AS classnumbers
         FROM     got_rnk
         WHERE     CONNECT_BY_ISLEAF = 1
         START WITH     rnk             = 1
         CONNECT BY     rnk             = PRIOR rnk + 1
              AND     gpno             = PRIOR gpno
              AND     super_classnumber  = PRIOR super_classnumber
    )
    SELECT DISTINCT
           g.gpno
    ,       c.classnumbers
    ,       g.age_min
    ,       g.age_max
    ,       g.amount
    FROM       got_gpno_classnumber_cnt  g
    JOIN       got_classnumbers         c  ON   c.gpno        = g.gpno
                                 AND  c.classnumber  = g.classnumber
    ORDER BY  g.gpno
    ,            c.classnumbers
    ;
    

    Out (just as you requested):

    GPNO       CLASSNUMBERS       AGE_MIN    AGE_MAX     AMOUNT
    ---------- --------------- ---------- ---------- ----------
    G123       1,3                      0         29          1
    G123       1,3                     30         35          2
    G123       1,3                     36         40          3
    G123       2                        0         29          1
    G123       2                       30         35          2
    G123       2                       36         40          5
    G124       1                        0         29          1
    G124       1                       30         35          2
    G124       1                       36         40          3
    
  • Help: SQL for the massive update (service lead)

    Hello

    I use Oracle11.2. I want to update the column of hist_dttm of tb_hist with the tb_base crt_dttm column value in the following line, which is ordered by crt_dttm. Here are the details:

    creat table tb_base (tid varchar2 (32), crt_dttm timestamp (6));
    creat table tb_hist (tid varchar2 (32), crt_dttm timestamp (6), upd_dttm timestamp (6));

    insert into tb_base values ("AAA", to_timestamp (12 January 05 14:00:00.123456', ' dd-mm-rr hh24:mi:ss.ff'));))
    insert into tb_base values ("AAA", to_timestamp (May 12 05 14:00:00.123456', ' dd-mm-rr hh24:mi:ss.ff'));))
    insert into tb_base values ("AAA", to_timestamp (16 December 05 14:00:00.123456', ' dd-mm-rr hh24:mi:ss.ff'));))

    insert into tb_base values ("AAA", to_timestamp (12 January 05 14:00:00.123456', 'dd-mm-rr hh24:mi:ss.ff'), null);
    insert into tb_base values ("AAA", to_timestamp (May 12 05 14:00:00.123456', 'dd-mm-rr hh24:mi:ss.ff'), null);

    I use the following SQL to update the column upd_dttm of the tb_hist, I'm waiting for the upd_dttm needs to be updated to "12/05/05 14:00:00.123456 ' and 14:00:00.123456 16 December 05. However they is NULL. Any suggestion?



    Update tb_hist hist
    Set (upd_dttm) = (select lead (base. CRT_DTTM over (Partition by order of base.tid of base.crt_dttm)
    tb_base base
    where base.tid = hist.tid
    and base.crt_dttm = hist.crt_dttm)
    ;
     update tb_hist
      set crt_dttm= (select min (crt_dttm)
           from tb_base
         where tb_base.crt_dttm > tb_hist.crt_dttm)
    

    Published by: DPT Opitz Consulting com on 09.10.2012 19:24

    Published by: DPT Opitz Consulting com on 09.10.2012 19:25

  • SQL for the calculation of the salary

    Version: 11.2

    Permanent employees get monthly salary, contract workers get only commission.
    Some permanent employees such as PETER and JOHANN get salary and Commission


    I want to find the total amount paid to permanent and non-permanent.

    The computation of the total, for employees who receive the salary and Commission as PETER and JOHANN, I want to ignore the Commission and considers that pay them for the calculation of total compensation.
    ie. When computing the total amount paid to all these employees
    
        I want to ignore commision of 400 received by PETER 
        and
        I want to ignore commision of 1000 received by  JOHANN
    That is to say. The Total amount paid will be: 18 500

    create table pay_master (emp_type varchar2(50) , empname varchar2(50), salary number , comm number );
    
    
    insert into pay_master values ( 'PERM', 'KAREN' , 2000, 0 );
    insert into pay_master values ( 'PERM', 'HANS'  , 3000, 0 );
    insert into pay_master values ( 'CONTRACT', 'KEITH'  , 0, 1000 );
    
    insert into pay_master values ( 'CONTRACT', 'ABDUL'  , 0, 2000 );
    insert into pay_master values ( 'PERM', 'KRISHNA'  , 1000, 0 );
    insert into pay_master values ( 'CONTRACT', 'CHENG'  , 0, 1500 );
    insert into pay_master values ( 'PERM', 'PETER'  , 5000, 400 );
    insert into pay_master values ( 'PERM', 'JOHANN'  , 3000, 1000 );
    
    
    col EMP_TYPE format a10
    col EMPNAME format a10
    
    SQL> select * From pay_master order by empname;
    
    EMP_TYPE   EMPNAME        SALARY       COMM
    ---------- ---------- ---------- ----------
    CONTRACT   ABDUL               0       2000
    CONTRACT   CHENG               0       1500
    PERM       HANS             3000          0
    PERM       JOHANN           3000       1000           ---------------> Ignore this commision when calculating the total pay
    PERM       KAREN            2000          0
    CONTRACT   KEITH               0       1000
    PERM       KRISHNA          1000          0
    PERM       PETER            5000        400           ---------------> Ignore this commision when calculating the total pay
    
    8 rows selected.
    
    SQL> select EMPNAME , salary+comm from pay_master order by empname;
    
    EMPNAME    SALARY+COMM
    ---------- -----------
    ABDUL             2000
    CHENG             1500
    HANS              3000
    JOHANN            4000
    KAREN             2000
    KEITH             1000
    KRISHNA           1000
    PETER             5400
    
    8 rows selected.
    
    SQL> select sum(salary+comm) from pay_master;
    
    SUM(SALARY+COMM)
    ----------------
               19900
    
    
    Expected output from the SQL with the above mentioned logic is 18500
    How can I do this in SQL? I think that I can't use CASE here statement because the CASE statement works only in a single column. Right?

    Hello

    J.Kiechle wrote:
    ... I think that I can't use CASE here statement because the CASE statement works only in a single column. Right?

    A CASE results in a single value expression. It may depend on any number of columns (that is, of reference): 0, 1, 2, 3 or more.

    For example, the following is based on 2 columns, x and y:

    CASE
        WHEN  x > y
        THEN  x
        ELSE  y
    END
    

    which is just another way to get the same results that

    GREATEST (x, y)
    

    You can use either of the foregoing, for your problem (assuming that the salary and the Commission are always 0 or more).

    Published by: Frank Kulash, Sep 21, 2012 05:40

  • Reader Extensions that solve? (Sorry for the stupid question)

    I tried to understand what RE done, but my little brain is not up to it. Here's my situation:

    I have no server. I have a form created using LS which is distributed to 50 users using Acrobat Reader. These users will be complete the form, save it, possibly print and email the filled-inform.

    The form requires some sort of database containing the names and multiple addresses. The names are used to populate a drop-down list contained in a subform repeatable. Whenever a new instance of the subform is created, the drop-down list is populated with the list of names for the selection. Selecting a name causes the address information be completed automatically in the subform.

    My solution so far is to have an another repeatable subform (1 to n instances) that contains the name/address information. The administrator enters the name/address information (1 per instance of subform), and then save the form, and then automatically sends it to the end user. Whenever info name/address changes, a new version of the form is distributed: end user does never update this information.

    It would be useful to maintain the name/address info in a spreadsheet instead. This would facilitate the maintenance of data (copy, sort, etc.). My understanding is that I can not use a data connection in the excel worksheet because of rights on strictly local forms management. This interpretation is correct?

    I want to distribute the form and an excel worksheet in order to update the form and the data independently.

    It seems that RE can address this problem? Is this correct?

    Thanks to everyone for all the advice and information!

    Reader Extensions allows you to turn on player features based on form by form. By default the player would not have the feature in question. There are two versions of Reader Extensions. You use inside Acrobat will allow you to add the right to save a PDF file locally, add a digital signature, and add his comments. The Acrobat version also has a license that allows you to distribute the Reader Extended form will allow only a maximum of 500 users.

    The other version is a server based product and a module inside the LiveCycle server. It has all the features mentioned above as well as the ability to connect to sources external to the form (such as a database or a web service). It supports other extensions, but you did not mention those so I focused on those that you need.

    Note that you need only drive to extend the form once (before distributing it).

    So, to accomplish what you want, you will need the version of the server.

    Hope that helps

    Paul

  • Help with Sql for the annual report by month

    Hi, I got the task of creating an annual report each month that shows the benefits of the enterprise by month and total in the last column to show what branch was the hightest income.
    Branch | January | February | March | April | Can | June... | Total |
    ABC | $0.00 | $0.00 | $0.00 | $0.00 | $0.00 | $0.00 | Total of the Amt |
    DEF | $18.01. $3.88. $18.01. $4.12 | $18.01. $3.97 | Total of the Amt |

    Can someone please help me give an idea of how to write sql for this report... ? I build subqueries for everymonth giving dates for Jan/Feb/March... but I think that this is not the right way to do it...
    -----------------------------------------------------------------------------------------------------------------------
    SELECT
    Sum (a.Commission) December,
    Sum (b.Commission) November
    Of
    (
    Select
    c.account_ID,
    c.Officer,
    c.account_product_class_id,
    Sum (c.dp_monthly_premium) Commission
    Of
    c contract
    Where
    c.account_ID = 109 and
    c.Status = 'APPROVED' and
    c.protection_effective between December 1, 2009 "and on December 31, 2009"
    Group by
    c.account_ID,
    c.Officer,
    c.account_product_class_id
    ),
    (
    Select
    c.account_ID,
    c.Officer,
    c.account_product_class_id,
    Sum (c.dp_monthly_premium) Commission
    Of
    c contract
    Where
    c.account_ID = 109 and
    c.Status = 'APPROVED' and
    c.protection_effective between November 1, 2009 "-November 30, 2009"
    Group by
    c.account_ID,
    c.Officer,
    c.account_product_class_id
    ) b
    -----------------------------------------------------------------------------------------------------------
    I always hight hope this forum. So please help. Thanks in advance.

    Published by: Aditi_Seth on January 26, 2010 14:29

    You may reach the columns using decode:

    Select sum (decode (to_char (c.protection_effective, 'MM'), 1, c.dp_monthly_premium, 0)) January
    , sum (decode (to_char (c.protection_effective, 'MM'), 2, c.dp_monthly_premium, 0)) February

    etc.

    At least, this will improve efficiency, because you need only make one pass.

    no guarantee that the media are quite right - I did not execute the query, but I think that you should get the idea!

  • variable presentation in the SQL for the scale marker

    ! http://img101.imageshack.us/img101/3476/sqlscalemarket.PNG!

    Hi, experts,

    I want to know if variable presentation is supported in the "sql query" "scale marker.

    I want to move the selected value from the prompt for the sql query!

    Thank you!

    I want to know if variable presentation is supported in the "sql query" "scale marker.

    Scale marker made reference here to the axis scale to increase the width and height or the zoom layout data is dedicated to the see, it has nothing to do with the variable presentation as such. If you can not pass any value for the variable.

  • SQL for the datetime type

    Hello

    help me in this.

    I have a sql to the datetime of the user input value:

    Select * from master_table
    where time < = 9 April 09 ' + 1

    It seems that I can not add '+ 1' here...

    April 9 09 is the web-based user input...

    My question: How can I add a '+ 1' every time that the user key in the user input text box?

    Thank you.

    You can change in your date format or add

    Select * from deadline-1=to_date('09-apr-09','DD-MON-YY master_table');

  • See APEX SQL for the treatment of automatic line

    Hello

    I get an error like this when you try to update with the automatic processing of line:
    ORA-20505: DML error: p_rowid = 89, p_alt_rowid = network_user_mou_id, p_rowid2 =, p_alt_rowid2 is. ORA-06550: line 1, column 17: PL/SQL: ORA-00936: lack of expression ORA-06550: line 1, column 9: PL/SQL: statement ignored
    Is there a way to see the generated SQL code so that I could determine what the problem is?

    Thank you
    Rick

    Rick:

    A way to see the SQL code executed would be to allow "sql_trace" before the process of automatic processing of line. Create a process that fires off the coast before before that the process of automatic line with the following line of code

    alter session set sql_trace=true;
    

    and a process that fires off the coast after the process of automatic line to disable tracing

    alter session set sql_trace=false;
    

    Trace files will occur in the "bdump" or "udump" Directory depending on whether you are using the EPG or OSH.

    As for the error itself, I wonder if it is due to a column that you recently added to the form.

    CITY

  • Casting table PL/SQL for the type of existing table and back ref cursor

    Hello



    I have the problem of casting a pl/sql table for the type of an existing table and turning the ref cursor to the application. Casting a ref cursor back and number of pl/sql table works well.



    Declarant

    < strong > TYPE type_table_name IS TABLE OF THE package_name.table_name%ROWTYPE; < facilities >

    within the stored procedure, fill in a table of this type temp_table_name and returning the ref cursor help

    < strong > results OPEN to SELECT * FROM TABLE (CAST (temp_table_name AS type_table_name)); < facilities >

    generates an error. type_table_name is unknown in this distribution. According to me, this happens because of the declaration of the type locally.



    Statement type_table_name inside the package specification does not work neither. Incredible, cast to the said dbms_sql.number_table to specify ref cursor back and dbms_sql package works very well!



    < strong > CREATE TYPE type_table_name IS TABLE OF THE package_name.table_name%ROWTYPE; < facilities > deals without any error but creates an invalid type complain a reference to package_name.table_name



    I don't want to declare every column in the table in type_table_name, because any change the table_name table would result in an inconsistent type_table_name.



    Thanks in advance!

    Edited by: user6014545 the 20.10.2008 01:04

    In any case you are right that there is a problem around anchorage (or maintaining) types of objects persistent to match the table structures, they may represent.

    In the case you describe, you might be better off just open the refcursor immediately the using one of the techniques described in the http://www.williamrobertson.net/documents/comma-separated.html to manage the delimited list.

    In the more general case where the line of treatment is necessary, you may make the pipeline functions.

    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    
    SQL> CREATE TABLE table_name
      2  AS
      3     SELECT ename column_name
      4     FROM   emps;
    
    Table created.
    
    SQL> CREATE OR REPLACE PACKAGE package_name
      2  AS
      3     TYPE type_name IS TABLE OF table_name%ROWTYPE;
      4
      5     FUNCTION function_name_pipelined (
      6        parameter_name IN VARCHAR2)
      7        RETURN type_name PIPELINED;
      8
      9     FUNCTION function_name_refcursor (
     10        parameter_name IN VARCHAR2)
     11        RETURN sys_refcursor;
     12  END package_name;
     13  /
    
    Package created.
    
    SQL> CREATE OR REPLACE PACKAGE BODY package_name
      2  AS
      3     FUNCTION function_name_pipelined (
      4        parameter_name IN VARCHAR2)
      5        RETURN type_name PIPELINED
      6     IS
      7     BEGIN
      8        FOR record_name IN (
      9           SELECT table_alias.*
     10           FROM   table_name table_alias
     11           WHERE  table_alias.column_name LIKE parameter_name) LOOP
     12
     13           PIPE ROW (record_name);
     14        END LOOP;
     15
     16        RETURN;
     17     END function_name_pipelined;
     18
     19     FUNCTION function_name_refcursor (
     20        parameter_name IN VARCHAR2)
     21        RETURN sys_refcursor
     22     IS
     23        variable_name sys_refcursor;
     24     BEGIN
     25        OPEN variable_name FOR
     26           SELECT table_alias.*
     27           FROM   TABLE (package_name.function_name_pipelined (
     28                     parameter_name)) table_alias;
     29
     30        RETURN variable_name;
     31     END function_name_refcursor;
     32  END package_name;
     33  /
    
    Package body created.
    
    SQL> VARIABLE variable_name REFCURSOR;
    SQL> SET AUTOPRINT ON;
    SQL> BEGIN
      2     :variable_name := package_name.function_name_refcursor ('%A%');
      3  END;
      4  /
    
    PL/SQL procedure successfully completed.
    
    COLUMN_NAME
    -----------
    ALLEN
    WARD
    MARTIN
    BLAKE
    CLARK
    ADAMS
    JAMES
    
    7 rows selected.
    
    SQL> ALTER TABLE table_name ADD (new_column_name VARCHAR2 (1) DEFAULT 'X');
    
    Table altered.
    
    SQL> BEGIN
      2     :variable_name := package_name.function_name_refcursor ('%A%');
      3  END;
      4  /
    
    PL/SQL procedure successfully completed.
    
    COLUMN_NAME NEW_COLUMN_NAME
    ----------- ---------------
    ALLEN       X
    WARD        X
    MARTIN      X
    BLAKE       X
    CLARK       X
    ADAMS       X
    JAMES       X
    
    7 rows selected.
    
    SQL>
    
  • SQL for the interface of FILES with column headers

    Hi all

    I designed an interface to extract data from Oracle to flat (.txt file).

    (1) I get the column headers in the output of file(. txt file) but I don't want to see any header column

    (2) for the creation of the data source in data model if I give any type of Date column I get the null value in the output file, but if I give the column type as string date filed I am able to see the data in the output file.



    Thank you
    Patel.

    Hi Pierrot

    (1) I get the column headers in the output of file(. txt file) but I don't want to see any header column
    You can set GENERATE_HEADER = flase and flow properties.

    -approach step by step on how to load some data from an oracle to flat file table
    http://www.Oracle.com/WebFolder/technetwork/tutorials/OBE/FMW/ODI/odi_11g/odi_project_table-to-flatfile/odi_project_table-to-flatfile.htm
    http://odiexperts.com/Oracle-to-flat-file/

    (2) for the creation of the data source in data model if I give any type of Date column I get the null value in the output file, but if I give the column type as string date filed I am able to see the data in the output file.
    I don't think you can use a data type Date during loading in the flat file. You can go with string or number/integer (if the date has no special characters. Here, you can use a conversion function to convert the data type Date existing according to your needs, but make sure that you select "source or on the staging")

    Concerning
    KK

  • write the query sql for the following situation?

    We have a table like format following...

    A AND B
    ...................
    10 30
    50 40
    60 80
    90 100


    so to write the query and get the result like formats following...


    RESULT
    ............
    30
    50
    80
    100


    Try this... He's one of the interview question. I can't write the query...


    If a knowledge write the query...

    Hello
    Try this

    select (case when a>b then a else b end)   "Result"  from ;
    
  • just curious, using pl.sql for the site

    Hello all;

    I have a small question, I made it using other tools, but I'm just trying to learn a few things again associated with pl/sql. If I have a site similar to below.

    http://www.BBC.co.UK/news/

    and I want to extract only the date of this site which is July 5, 2012 update at 14:38 HE and record that information in a table. Is this possible with pl/sql

    http://www.morganslibrary.org/reference/pkgs/utl_http.html

    If you use 11 GR 1 material or above you will also need this:
    http://www.morganslibrary.org/reference/pkgs/DBMS_NETWORK_ACL_ADMIN.html

Maybe you are looking for