Using DateTime in a cursor

I would use a slider with OffsetDateTime/LocalDateTime values (JDK 8)

I thought to convert time values to time format and transmit the zipper. However, I would like to link to DoubleProperty value the Slider and convert that into OffsetDateTime/LocalDateTime format so I can display the update in a label.

From what I've seen, seems that I need to convert the double value back to long so I can then analyze this long value in a DateTime format.

Is this possible?

Thanks in advance,

ENO

Not tested, but something like:

import java.time.Duration;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

import javafx.application.Application;
import javafx.beans.binding.DoubleBinding;
import javafx.beans.binding.ObjectBinding;
import javafx.beans.binding.StringBinding;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.Slider;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

public class DateSlider extends Application {

 @Override
  public void start(Stage primaryStage) {
  final VBox root = new VBox(10);
  final ObjectProperty startTime = new SimpleObjectProperty<>(LocalDateTime.of(2013, 1, 1, 0, 0));
  final ObjectProperty endTime = new SimpleObjectProperty<>(LocalDateTime.of(2014, 1, 1, 0, 0));
  final ObjectProperty currentSliderTime = new SimpleObjectProperty<>();
  final Slider slider = new Slider();
  slider.setMin(0);
  slider.maxProperty().bind(new DoubleBinding() {
      { super.bind(startTime, endTime); }
      @Override
      public double computeValue() {
            return Duration.between(startTime.get(), endTime.get()).toMillis();
      }
  });
  currentSliderTime.bind(new ObjectBinding() {
      { super.bind(slider.valueProperty(), startTime); }
      @Override
      public LocalDateTime computeValue() {
            return startTime.get().plus(Duration.ofMillis(slider.valueProperty().getValue().longValue()));
      }
  });
  final Label label = new Label();
  label.textProperty().bind(new StringBinding() {
      { super.bind(currentSliderTime); }
      @Override
      public String computeValue() {
            return DateTimeFormatter.ISO_LOCAL_DATE.format(currentSliderTime.get());
      }
  });
  root.getChildren().addAll(slider, label);
  Scene scene = new Scene(root, 300, 100);
  primaryStage.setScene(scene);
  primaryStage.show();
  }

  public static void main(String[] args) {
  launch(args);
  }
}

Post edited by: James_D (corrected some errors in code).

Tags: Java

Similar Questions

  • What representations using implicit or expicit cursor?

    Don't you be any considaration to use implicit or explicit cursors? I would like to know, especially in terms of performance, when and if it is better to choose betweeen implicitly and a explicit cursor. I'm working on Oracle. 8.1.7
    Thanks in advance.

    Mark1970 wrote:
    Don't you be any considaration to use implicit or explicit cursors? I would like to know, especially in terms of performance, when and if it is better to choose betweeen implicitly and a explicit cursor. I'm working on Oracle. 8.1.7

    There is no difference from the point of view SQL Shared Pool. All SQLs are analyzed as cursors and stored in the shared Pool.

    The SQL engine returns a handle or reference (you can even call a pointer) to the language of the client (Java, PL/SQL, etc.) that he send the SQL statement.

    So the SQL engine, there is no difference. He does not care how the client will use that face returned. If the customer uses this handle as an implicit cursor handle, an explicit cursor handle, the ref, the handle for DBMS_SQL cursor cursor handle... or whatever. He is indifferent to the SQL cursor in the pool shared SQL. He cannot do this slider faster or slower execution.

    On the client side, there are several reasons why it can use this handle to SQL cursor returned by the SQL engine as a variable of implicit cursor or explicit... or as a ref cursor variable These reasons dictate which is the best tool for the job at hand - and the programmer must understand these and select the right tool for the job.

    There is therefore no such thing as an implicit cursor being better or faster than a cursor, explicit, or vice versa. Both are tools to deal with a SQL cursor in the SQL engine. A procedure/package can use this SQL cursor via an implicit cursor variable. An another procedure/package can use the same SQL cursor via an explicit cursor variable.

    So it's not that one is better.

    It's the programmer understand that a cursor is, HOW the client implements access to this SQL cursor via variables of cursor cursor cursor/DBMS_SQL Ref. variables or explicit/implicit... and by CHOOSING the more it is necessary to perform the task at hand.

  • Possible bug found in hyperlinkctrl.c when you use the "VAL_POINTING_FINGER_CURSOR" mouse cursor in your own user interface.

    Hi people, I think I found a bug in the hyperlinkctrl.c custom control, after the update/upgrade an old project CVI.

    I found when I started using the "VAL_POINTING_FINGER_CURSOR" mouse in my UI, when adding a new hyperlink control.

    The error is recoverable error: ' from the mouse cursor is not valid.

    This error breaks in RunUserInterface (never seen anything like this before and I use CVI since version 3.1).

    This happens whenever I mouse - hovering anywhere on the Panel that contains the new hyperlink control.

    I also had a hack temporary to solve the problem, for now, I'll pass it along to this announcement...

    The hyperlink control's source code is located in \toolslib\custctrl\hyperlinkctrl.c

    The bug/problem lies in the service of reminder (of HyperLinkPanelCallback), specifically in lines 460 to 465.

    This hyperlink control wants to use the VAL_POINTING_FINGER_CURSOR as its default cursor when you hover over the custom hyperlink.

    However, if you already use 'VAL_POINTING_FINGER_CURSOR' in your user interface, the branch which verifies that you use what he thinks is 'his own' thread-safe mouse cursor ID, so that can reset it by using his "token concatenation" - created macro "GetTsvCursor", is not an 'else' branch to protect the picture when you actually use the cursor pointing finger... where the error that the mouse cursor is not valid. Here is the snippet of these lines.

    The mouse is not over a hyperlink
    If (cursor is VAL_POINTING_FINGER_CURSOR)
    {
    Reset the cursor to the previous cached cursor
    cursor = GetTsvCursor();
    errChk (SetMouseCursor (cursor));

    ... etc...

    }

    So my hack was to change the type of cursor to "VAL_CHECK_CURSOR" in place and place the cursor of "VAL_POINTING_FINGER_CURSOR" in three locations in this function, then rebuilt files x 86 and x 64.

    Hey Luis, finally win a free T-shirt of LabWindows/CVI with not only have reported this bug, but also to give the precise location of the source, as well as a work around?

    :^)

    JB

    In the meantime, I have submitted a bug with ID #545203 report to track down this problem.

    -Johannes

  • When scrolling down using the touchpad, the cursor jumps to the back arrow

    Hi, could someone tell me why when I use my touchpad, I move the cursor over the arrow down to scroll down and sometimes the cursor jumps on the back button on the screen and goes back one screen and I lose what I'm getting?

    Thank you.  I understand.  I went to the mouse and then to the touchpad device settings and I was able to change.  They were called corner buttons.  They function as shortcuts to different things on each corner of the touchpad.  I disabled it.

  • Cannot sort the results table using datetime attribute

    I use short 3.1. My result table disappears when I try to sort by using a date/time attribute. I also saw him sometimes throw me an error: in ORDER BY clause: ORDER BY clauses may refer only to the attributes set in the same statement. I don't have any problem sorting the same point of view on a list of result of the datetime attribute. What could be wrong?

    I installed the provided patch support of oracle and it works. My studio version was 3.1.14220. After connection, the version is 3.1.18915.

  • Using using Cluase for dynamic cursors using Bind Variables.

    Hello

    I have a quick question. I build dynamic cursor depends on the setting. The one here is my common charly.

    I use the 5 parameter in place several in my query. So, I use almost 40 values if I used with would adopt it. Is there another way to manage rather than spend 40 times.
    SELECT
            decode(GROUPING(nvl2(p_level5, nvl(hier.LVL6,''UNKNOWN''), nvl2(p_level4, nvl(hier.LVL5,''UNKNOWN''),
              nvl2(p_level3, nvl(hier.LVL4,''UNKNOWN''), nvl2(p_level2, nvl(hier.LVL3,''UNKNOWN''),
              nvl2(p_level1, nvl(hier.LVL2,''UNKNOWN''), nvl(hier.LVL1,''UNKNOWN''))))))), '1', 'Total',
              nvl2(p_level5, nvl(hier.LVL6,''UNKNOWN''), nvl2(p_level4, nvl(hier.LVL5,''UNKNOWN''),
              nvl2(p_level3, nvl(hier.LVL4,''UNKNOWN''), nvl2(p_level2, nvl(hier.LVL3,''UNKNOWN''),
              nvl2(p_level1, nvl(hier.LVL2,''UNKNOWN''), nvl(hier.LVL1,''UNKNOWN''))))))) NAME,
              SUM(kpi),
              .....
    from  tb_test1,...
    where  WHERE upper(nvl(LVL1, ''UNKNOWN'')) = upper(nvl(p_level1, LVL1))
            AND upper(nvl(LVL2, ''UNKNOWN'')) = upper(nvl(p_level2, LVL2))
            AND upper(nvl(LVL3, ''UNKNOWN'')) = upper(nvl(p_level3, LVL3))
            AND upper(nvl(LVL4, ''UNKNOWN'')) = upper(nvl(p_level4, LVL4))
            AND upper(nvl(LVL5, ''UNKNOWN'')) = upper(nvl(p_level5, LVL5))
            AND upper(nvl(LVL6, ''UNKNOWN'')) = upper(nvl(p_level6, LVL6))
          GROUP BY ROLLUP(nvl2(p_level5, nvl(hier.LVL6,''UNKNOWN''), nvl2(p_level4, nvl(hier.LVL5,''UNKNOWN''),
              nvl2(p_level3, nvl(hier.LVL4,''UNKNOWN''), nvl2(p_level2, nvl(hier.LVL3,''UNKNOWN''),
              nvl2(p_level1, nvl(hier.LVL2,''UNKNOWN''), nvl(hier.LVL1,''UNKNOWN'')))))))
          ORDER BY nvl2(p_level5, nvl(hier.LVL6,''UNKNOWN''), nvl2(p_level4, nvl(hier.LVL5,''UNKNOWN''),
              nvl2(p_level3, nvl(hier.LVL4,''UNKNOWN''), nvl2(p_level2, nvl(hier.LVL3,''UNKNOWN''),
              nvl2(p_level1, nvl(hier.LVL2,''UNKNOWN''), nvl(hier.LVL1,''UNKNOWN''))))));
    Appreciated your help.

    Kind regards
    Vincent.

    Just capture once inside SQL, then use local versions of their

    for example

    with t as (select p_level1 as pl1
                     ,p_level2 as pl2
                     ,p_level3 as pl3
                     ,p_level4 as pl4
                     ,p_level5 as pl5
               from dual)
    SELECT
            decode(GROUPING(nvl2(pl5, nvl(hier.LVL6,''UNKNOWN''), nvl2(pl4, nvl(hier.LVL5,''UNKNOWN''),
              nvl2(pl3, nvl(hier.LVL4,''UNKNOWN''), nvl2(pl2, nvl(hier.LVL3,''UNKNOWN''),
              nvl2(pl1, nvl(hier.LVL2,''UNKNOWN''), nvl(hier.LVL1,''UNKNOWN''))))))), '1', 'Total',
              nvl2(pl5, nvl(hier.LVL6,''UNKNOWN''), nvl2(pl4, nvl(hier.LVL5,''UNKNOWN''),
              nvl2(pl3, nvl(hier.LVL4,''UNKNOWN''), nvl2(pl2, nvl(hier.LVL3,''UNKNOWN''),
              nvl2(pl1, nvl(hier.LVL2,''UNKNOWN''), nvl(hier.LVL1,''UNKNOWN''))))))) NAME,
              SUM(kpi),
              .....
    from  t, tb_test1,...
    where  WHERE upper(nvl(LVL1, ''UNKNOWN'')) = upper(nvl(pl1, LVL1))
            AND upper(nvl(LVL2, ''UNKNOWN'')) = upper(nvl(pl2, LVL2))
            AND upper(nvl(LVL3, ''UNKNOWN'')) = upper(nvl(pl3, LVL3))
            AND upper(nvl(LVL4, ''UNKNOWN'')) = upper(nvl(pl4, LVL4))
            AND upper(nvl(LVL5, ''UNKNOWN'')) = upper(nvl(pl5, LVL5))
            AND upper(nvl(LVL6, ''UNKNOWN'')) = upper(nvl(p_level6, LVL6))
          GROUP BY ROLLUP(nvl2(pl5, nvl(hier.LVL6,''UNKNOWN''), nvl2(pl4, nvl(hier.LVL5,''UNKNOWN''),
              nvl2(pl3, nvl(hier.LVL4,''UNKNOWN''), nvl2(pl2, nvl(hier.LVL3,''UNKNOWN''),
              nvl2(pl1, nvl(hier.LVL2,''UNKNOWN''), nvl(hier.LVL1,''UNKNOWN'')))))))
          ORDER BY nvl2(pl5, nvl(hier.LVL6,''UNKNOWN''), nvl2(pl4, nvl(hier.LVL5,''UNKNOWN''),
              nvl2(pl3, nvl(hier.LVL4,''UNKNOWN''), nvl2(pl2, nvl(hier.LVL3,''UNKNOWN''),
              nvl2(pl1, nvl(hier.LVL2,''UNKNOWN''), nvl(hier.LVL1,''UNKNOWN''))))));
    
  • 2 running, 1 inside and 1 sql external, dynamic queries using loops and ref Cursor

    Hi all

    I'm under Oracle 10.2.0.2. I'm currently building dynamic sql using external and internal queries ref Cursor. Queries make use of user selected lists of ID, which is stored in a table in memory at run time. My example is as follows. From a list of book_publication_id on a web page, the user selects several books. The same user selects then several maps from a list of map_publication_id on the same web page. A book contains several maps and some of these cards will appear in more than one book (aka many many relationships).

    This should then ask the following output to a new web page:
    Outer loop:  Display book details for book_publication_id 230
      Inner loop:  Display 1st map details for map_publication_id 340
      Inner loop:  Display 2nd map details for map_publication_id 346
      Inner loop:  Display 3rd map details for map_publication_id 350
    Outer loop:  Display book details for book_publication_id 240
      Inner loop:  Display 1st map details for map_publication_id 346
      Inner loop:  Display 2nd map details for map_publication_id 375
    Outer loop:  Display book details for id 255
    and so on.
    In the example above, the outer loop displays the details of the book for book_publication_id 230 and the inner loop displays all the users selected the maps in book_publication_id 230. Then, it moves on the details of the book for book_publication_id 240 and done the same thing again. Similar in some ways to how break would work in SQL * Plus, even if the table is built like an HTML, the book details must be on a separate line for the card details. However I don't know how I would want it to work.

    So far, using loops, I could not show all the details of card for each different book_publication_id, after the details of the book for only 1 book_publication_id are displayed each time. If a loop in a loop. I hope that makes sense. I think this is my internal request that it be built differently. My code for this part of the program, which is currently wrong, is as follows:
    --Global variable section contains:
    var_user_chosen_map_list_ids VARCHAR2(32767);
    var_details VARCHAR2(32767);
    ......
    PROCEDURE PROCMAPSEARCH (par_user_chosen_map_list_ids PKG_ARR_MAPS.ARR_MAP_LIST)
    IS
    BEGIN
    FOR rec_user_chosen_map_list_ids IN 1 .. par_user_chosen_map_list_ids.count
    LOOP
       var_user_chosen_map_list_ids := var_user_chosen_map_list_ids || 
       '''' || 
       par_user_chosen_map_list_ids(rec_user_chosen_map_list_ids) || 
       ''',' ;
    END LOOP;
     var_user_chosen_map_list_ids := substr(var_user_chosen_map_list_ids,
                                            1, 
                                            length(var_user_chosen_map_list_ids)-1);
    var_details := FUNCMAPDATAFIND (var_user_chosen_map_list_ids);
    htp.print(var_details);
    END PROCMAPSEARCH;
    FUNCTION FUNCMAPDETAILS (par_user_chosen_map_list_ids IN VARCHAR2(32767)
    RETURN VARCHAR2
    AS
    TYPE cur_type_map IS REF CURSOR;
    cur_book_search cur_type_map;
    var_book_date NUMBER(4);
    var_book_title VARCHAR2(32767);
    cur_map_search cur_type_map;
    var_map_date NUMBER(4);
    var_map_title VARCHAR2(32767);
    begin:
    OPEN cur_book_search FOR
    'SELECT BI.book_date,
            BT.book_title
     FROM   BOOK_INFO BI,
            BOOK_TITLE BT,
            TABLE (sys.dbms_debug_vc2coll(' || par_user_chosen_book_list_ids || ')) BL_1
     WHERE BI.book_title_id = BT.book_title_id
     AND BI.book_publication_id = BL_1.column_value';
    OPEN cur_map_search FOR
    'SELECT MI.map_date,
           MT.map_title
    FROM map_info MI,
         map_title MT,
         TABLE (sys.dbms_debug_vc2coll(' || par_user_chosen_book_list_ids || ')) BL_2
         TABLE (sys.dbms_debug_vc2coll(' || par_user_chosen_map_list_ids || ')) ML
    WHERE MI.map_title_id = MT.map_title_id
    AND BI.book_publication_id = BL_2.column_value
    AND BI.book_publication_id = MI.pub_publication_id
    AND MI.map_publication_id = ML.column_value';
    LOOP
    LOOP
    FETCH cur_map_compare INTO
    var_book_date,
    var_book_title;
    var_details
    var_details := var_details || 'Book date: '||
                        var_book_date ||
                        'Book title: ' ||
                        var_book_title;
    FETCH cur_map_compare INTO
    var_map_date,
    var_map_title;
    var_details := var_details || 'Map date: '||
                        var_map_date ||
                        'Map title: ' ||
                        var_map_title
    EXIT WHEN cur_book_compare%NOTFOUND;
    END LOOP;
    EXIT WHEN cur_map_compare%NOTFOUND;
    END LOOP;
    RETURN var_details;
    END FUNCMAPDETAILS;
    If anyone has any ideas or suggestions, I would be grateful. It is an extension of my previous code, I posted a question recently. As I am working and learning a step at a time, I left this idea in my previous question, that I had to make sure I knew that first.

    Kind regards

    Tim

    Using dynamic SQL

    declare
      dd sys_refcursor;
      ee sys_refcursor;
      d dept%rowtype ;
      e emp%rowtype ;
    begin
    open dd for 'select * from dept' ;
    loop
    fetch dd into d ;
    exit when dd%notfound ;
    dbms_output.put_line('Department:'||d.dname);
      open ee for 'select * from emp where deptno='||d.deptno ;
      loop
      fetch ee into e ;
      exit when ee%notfound ;
      dbms_output.put_line('..Employee:'||e.empno||':'||e.ename);
      end loop;
    end loop ;
    end ;
    /
    Department:ACCOUNTING
    ..Employee:7782:CLARK
    ..Employee:7839:KING
    ..Employee:7934:MILLER
    Department:RESEARCH
    ..Employee:7369:SMITH
    ..Employee:7566:JONES
    ..Employee:7788:SCOTT
    ..Employee:7876:ADAMS
    ..Employee:7902:FORD
    Department:SALES
    ..Employee:7499:ALLEN
    ..Employee:7521:WARD
    ..Employee:7654:MARTIN
    ..Employee:7698:BLAKE
    ..Employee:7844:TURNER
    ..Employee:7900:JAMES
    Department:OPERATIONS
    
    PL/SQL procedure successfully completed.
    

    HTH

    SS

  • Report regions - use of the Ref Cursor?

    APEX 4.2

    See http://mikesmithers.wordpress.com/2012/02/22/getting-apex-to-play-with-ref-cursors

    The above article is older than 2 years. The techniques shown in the link above still valid today if we want to create a report region in the APEX are based on a function that returns a Ref Cursor? Are there improvements in this area for the next APEX 5.0 and/or database Oracle 12 c?

    Thank you

    HELEN wrote:

    APEX 4.2

    See http://mikesmithers.wordpress.com/2012/02/22/getting-apex-to-play-with-ref-cursors

    The above article is older than 2 years. The techniques shown in the link above still valid today if we want to create a report region in the APEX are based on a function that returns a Ref Cursor?

    If the function returns the ref cursor is the only point of access that you have data then Yes, it probably is. If you have direct access to the underlying database objects and the function does not have something very complicated, then you are probably better off creating your own body of the function returning SQL query data source.

    Everything about the dynamics of ref Cursor now I divided in 2 layers, with a function for generating the dynamic SQL and another for bind parameters open the ref cursor. APEX apps can then reuse the functions of SQL query in function body return SQL query data sources (if you take a bit of care to keep the bind variable names vaguely APEX-point-friendly).

    Are there improvements in this area for the next APEX 5.0 and/or database Oracle 12 c?

    See this for the technical background on why APEX is not yet support ref Cursor and this for more information of the Oracle team on the possibility of future support. Obviously, he did not he in 4.1. I suspect that data REF CURSOR region sources depended on a minimum requirement of DB of the 11.1.0.6 (where was introduced support for the conversion of the REF CURSOR in the cursors DBMS_SQL). As minimum DB for APEX 5.0 version is 11.1.0.7, it would be a possible feature for 5.0, but it is not classified as one.

  • If the mobile is valid or not by using the Pl/SQL cursor

    Hello

    Can someone please email me a cursor query to see if an mobileno is valid or not.

    Table name Cc_customer
    mobileno domain name
    length should be 10 and start by 9, length should be 12 and start with 919

    Do you mean something like this?

    SQL> ed
    Wrote file afiedt.buf
    
      1  with t as (select '9123456780' as mobile from dual union all
      2             select '919123456780' from dual union all
      3             select '12345' from dual union all
      4             select '1234567890' from dual union all
      5             select '123456789012' from dual)
      6  --
      7  -- END OF TEST DATA
      8  --
      9  select mobile
     10        ,case when regexp_like(mobile, '^((91)?9[0-9]{9})$') then 'valid'
     11         else 'invalid'
     12         end as chk
     13* from t
    SQL> /
    
    MOBILE       CHK
    ------------ -------
    9123456780   valid
    919123456780 valid
    12345        invalid
    1234567890   invalid
    123456789012 invalid
    
    SQL>
    
  • How to use DBMS_PARALLEL_EXECUTE with CURSOR

    I write data from Oracle database MongoDB via http calls (POST, PUT). Data is changing and I'm entering it via a slider and then inside the loop for example, I make the call http (appealed by iteration). MongoDb does not write in bulk, so I have to send one line per iteration. It takes a lot of time (for example, 30 minutes to write 3 K lines).

    Inspired by the answer to this question that I figured out that the process can be more effective with the help of DBMS_PARALLEL_EXECUTE. However, this part "run each thread (parallel work process) using a standard FOR cursor loop (for example for in(select...)). c loop... end loop; )- and inside the loop, make HTTP calls" is not not clear to me."

    I have the following syntax:

    FOR c IN
              (SELECT......)
    LOOP
              --http calls
    END LOOP;)
    
    


    I tried to read the examples here , but I couldn't understand the following:

    • Based on what I should create pieces in my case (ROWID, collar number or SQL)?
    • Where should I create task? At the beginning of my procedure? Inside the loop? And where I create pieces? Inside the loop?
    • What about DBMS_PARALLEL_EXECUTE.run_task?
    • What is the size of chunck? I understand that I can open only 5 max http calls at the same time

    Your help is very appreciated.

    P.S. I preferred to open the new thread, as the discussion will be on DBMS_PARALLEL_EXECUTE instead of the sliders of best practices.

    Yes, you can not chunk a cursor (compiled and analyzed SQL).

    You need for the block using a SQL (SQL source code). And this SQL must return the piece ranges using custom logic.

    If a table must be stored in a block or a SQL statement must provide the pieces. A cursor cannot be chunked, as Oracle has absolutely no idea that the lines will be processed by the slider - what is discovered only when the cursor is running and running and looking for lines. And by then, the process is already running and cannot be transformed into a parallel process.

    In other words, the workload must be known, to chunk this workload - it break up in smaller workloads. A cursor represents an unknown work load. How many rows will be treated? Unknown until the cursor runs and made search lines to deal with. An unknown work load can be stored in a block.

  • When to use the cursor for loop and the cursor (open, fetch, close)

    Hello world
    I have a small doubt about when to use the cursor for loop and when to use the cursor for loop and the cursor (open, fetch, close).
    Well, I'm not the difference between implicit and explicit cursor. So please tell me how I got to know, what to use and when?




    Kind regards
    BS2012

    Published by: BS2012 on January 29, 2013 12:15

    All SQLs are analyzed, stored and executed as cursors. Thus, you will always use a cursor.

    The problem is that languages, such as PL/SQL, provide different interfaces to interact with the SQL cursor. As the ref, the slider interface, the interface DBMS_SQL slider interface and so on.

    Each of these interfaces offers different features. For example, using the interface DBMS_SQL allows binding dynamics and dynamic recovery. The Ref Cursor interface allows your code PL/SQL pass a handle to a reference pointing to the SQL cursor, to an external client. Etc.

    The fundamental reason for the use of an explicit cursor interface is mainly that you own and manage bulk made extraction output provided by PL/SQL cursor.

    With a cursor FOR , the motor loop of PL/SQL optimize the loop by extracting block a 100 lines both. However, you cannot access this collection in bulk directly inside the loop.

    With an explicit cursor interface, you specify the size of the extraction in bulk via the clause LIMIT , and you set the variable of collection to use. This allows you to use the collection directly variable inside the loop.

    However, the need to do - code manually in bulk collection - rarely occur in the daily programs in PL/SQL. A line of treatment is both slow and not well fits. And even if your bulk code collects lines, these lines must still be processed one at a time in your code. It is much more efficient and scalable rather write SQL code, and make the engine SQL the line of treatment for you.

  • using plsql table and ref cursor in oracle's 10 g

    Hi all
    Can someone give me an example of a scenario where we need to create a form manually based on a stored database procedure.
    And in this process, I created a pl/sql table and a Ref cursor at the database level.

    CREATE OR REPLACE PACKAGE SCOTT. TYPE BONUS_PKG IS bonus_rec
    IS (RECORD
    EmpNo bonus_EMP.empno%TYPE,
    Ename bonus_EMP.ename%TYPE,
    employment bonus_EMP.job%TYPE,
    SAL bonus_EMP.sal%TYPE,
    Comm bonus_EMP.comm%TYPE);

    TYPE b_cursor IS REF CURSOR RETURN bonus_rec;
    TYPE bontab IS TABLE OF bonus_rec INDEX DIRECTORY.

    PROCEDURE bonus_refcur (bonus_data IN OUT b_cursor);
    PROCEDURE bonus_query (bonus_data IN OUT bontab);
    END bonus_pkg;


    CREATE OR REPLACE PACKAGE BODY SCOTT. BONUS_PKG IS
    PROCEDURE bonus_query (bonus_data IN OUT bontab) IS
    II NUMBER;
    CURSOR bonselect IS
    SELECT empno, ename, job, sal, comm bonus_EMP ORDER BY empno;
    BEGIN
    OPEN bonselect.
    II: = 1;
    LOOP
    Look FOR bonselect IN
    .EmpNo bonus_data (ii),
    .ename bonus_data (ii),
    .job bonus_data (ii),
    .Sal bonus_data (ii),
    .comm bonus_data (ii);
    EXIT WHEN bonselect % NOTFOUND;
    II: = ii + 1;
    END LOOP;
    END bonus_query;

    PROCEDURE bonus_refcur (bonus_data IN OUT b_cursor) IS
    BEGIN
    Bonus_data OPEN to SELECT empno, ename, job, sal, comm bonus_EMP ORDER BY empno;
    END bonus_refcur;

    END bonus_pkg;

    I want to fill in the data in the forms manually is not using Forms data block Wizard and by program.

    Please answer...

    Can someone give me an example of a scenario where we need to create a form manually based on a stored database procedure.

    In general, you will use a block of proceedings based when you have a collection of data from several tables presented in a form and your username must be able to update the information displayed.

    In your sample code, looks like you are using Oracle Support document "Melting a block on a Stored Procedure - examples of Code [ID 66887.1]". If this is the case, continue to follow the document - it guides you through all the steps. There is no need to manually configure things that the data block Wizard will work for you!

    I want to fill in the data in the forms manually is not using Forms data block Wizard and by program.

    Why? Let the wizard block configuration data of your block based on a procedure for you. There is no need to manually browse the data! I did what you're trying, and it's more work needed. Leave forms to do the work for you. :)

    If you absolutely have to do things manually, I recommend that you use the PROCEDURE bonus_query (bonus_data IN OUT bontab) instead of bonus_refcur (bonus_data IN OUT b_cursor) . Then, in your code create a variable of type BONTAB, and then call the bonus_query procedure. Then, it's a simple case of a loop in the table of records returned by the bonus_query procedure. For example:

    DECLARE
       t_bonus    bonus_pkb.bontab;
    BEGIN
       bonus_pkg.bonus_query(t_bonus);
    
       FOR i in 1 .. t_bonus.count LOOP
          :YOUR_BLOCK.EMPLOYEE_NUMBER := t_bonus(i).empno;
          :YOUR_BLOCK.EMPLOYEE_NAME := t_bonus(i).ename;
          :YOUR_BLOCK.EMPLOYEE_JOB := t_bonus(i).job;
          :YOUR_BLOCK.EMPLOYEE_SALARY := t_bonus(i).sal;
          :YOUR_BLOCK.EMPLOYEE_COMMISSION := t_bonus(i).comm;
       END LOOP;
    END;
    

    This code example shows the basics, but as is the sample code - you will need to adapt to your situation.

    Also, I highly recommend that you look at the article inol listed. It is a very thorough debate on the REF CURSOR. If you have set up using a procedure based on the data source - it is more effective to spend the record table to your form that it must pass a ref cursor Using a ref cursor, you might as well just using a standard called cursor and loops on your named cursor. The effect is the same (a line returned at the same time creating lots of network traffic). Using the table of records is more efficient because the data set is returned if the network traffic is reduced.

    Hope this helps,
    Craig B-)

    If someone useful or appropriate, please mark accordingly.

  • Using numbers to create a table where the value of the line increases automatically

    Hello

    I created a table (pictured below) to help calculate my self-employed income:

    INDEX

    DATE

    HAVING RETURNED TO THE SELF-EMPLOYED

    £

    A1

    I want to create an index / of reference for each line so that I can connect to receipts.

    I like the index / reference to automatically increase i.e. A2, A3 etc when I create a new line by using the shortcut 'alt - cursor down' but to note has managed to find out what formula to use.

    Any help would be great!

    Thank you very much

    Stophen.

    You can try something like this:

    = 'A' & rangee()

    SG

  • Can't use scroll function more - EQUIUM A200-1AC

    Hello

    I'm a new user of this great site and looking forward to get some knowledge of other respected users. I have a small problem and if anyone can help me solve this problem, I would be very grateful.

    I have a Toshiba laptop (Windows Vista), I used to page up and down to move my finger on the side of the touch pad instead of use the scrolling/drag cursor, but who can't do more.

    impatience of someone.

    Thank you

    Hello

    It would be interesting to know what Toshiba laptop, you exactly...

    I think you mean the virtual scrolling feature. Have you checked whether it s always enabled in the settings of the touchpad?

  • Yoga13: Yoga cursor

    My cursor is constantly disappearing, and I can't get back without having to restart the computer. Everything else works fine. Is there a button I'm pressing by mistake?

    Note from Moderator: Edition subject to the content of the game.

    I was looking around, because I had this same problem, especially during the passage of the tablet in portable mode, and I think I stumbled on the answer while frustratedly futzing autour.

    To restore the cursor

    Press F6

    The touch screen

    Use the touchpad (the cursor will return)

    To hide the cursor

    Press F6

    The touch screen

    I hope it works for someone else the trouble.

Maybe you are looking for

  • How to use iCloud

    HI, please help a total techaphobe. I need to store my photos in iCloud (that is already installed on my iPad, I have Apple ID n all). I tried to select the photos, but there is no option, then save in the cloud. Perhaps they are there already as the

  • Not recognized by Word or Photoshop photo library

    Work on a MacBook and recently installed Sierra 10.12.  Everything worked fine until all applications 3rd party such as Word, Excel, Powerpoint, (office 11 14.6.8), Photoshop Elements 10 has ceased to recognize the new photo library.  iPhoto and phot

  • Enable Web Services on HP LaserJet CP1525nw

    We are trying to install web print on HP LaserJet CP1525nw service. This is a printer over the network from a server windows server 2008 R2 for Windows 7 x 64 machines It is connected to a network wired and all (printing etc.) works execpt WebService

  • Need webcam without wireless/Bluetooth for my booklet

    Hello I want to buy a webcam which is connection/wifi wireless or bluetooth for my booklet. Please could you suggest a suitable for this model. Your help would be very happy.Kind regards.

  • New HP ENVY 17 Quad t mobile, Intel® Core? I7-4700MQ unable to connect to the internet

    Just got a HP ENVY 17 t mobile Quad, Intel® Core? I7-4700MQ.  It shows my WiFi as a maximum of five bars.  Sometimes it connect, but most of the time, it shows limited.  Either way I can't connect to the internet.  I have another laptop (Windows 7),