How to create a record of pl/sql in oracle

Oracle Forms 6i

Hai All

My question how to create a record with a cursor for loop.

While I'm generating my if statement elsif only some of my files are not completely recovered, so I generate using the cursor for loop pls tell how to do

My code is

declare
t_in dail_att.intime%type;
t_out dail_att.intime%type;
t_code dail_att.barcode%type;
dail_att.attend_date%type V_DATE;

cursor cur_test is
Select respondent, outtime, barcode, dail_att attend_date;
-in t_in, t_out, t_code, dail_att V_DATE;

Start

go_block ('TEST_SRI');
PREMIER_ENREGISTREMENT;
LOOP

If: bartime between 0145 and then 0630
Update dail_att set = outtime: bartime where barcode =: bar code
and ATTEND_DATE =: BARDATE-1 and intimate are zero and outtime is not null;


elsif: bartime between 0630 and 0900 or: bartime between 1130 and 1230 or
: bartime between 1700 and 1800 and t_in is null then

insert into dail_att(barcode,intime,attend_date)
values(:Barcode,:Bartime,:bardate);

elsif: bartime > 1645 and t_in is not null and t_out is null then
Update dail_att set = outtime: bartime where barcode =: bar code
and ATTEND_DATE =: BARDATE and respondent are not null and outtime has the value null.
on the other

Update dail_att set = outtime: bartime where barcode =: bar code
and ATTEND_DATE =: BARDATE and respondent are not null and outtime has the value null.

end if;
WHEN THE OUTPUT: SYSTEM. LAST_RECORD = "TRUE" OR: BAR CODE IS NULL;
NEXT_RECORD;
END LOOP;
forms_ddl ('commit');
exception
while others then
forms_ddl ('rollback');
message(SQLERRM|| dbms_error_Text);
message(SQLERRM|| dbms_error_Text);
End;


Pls tell me if I need to create a folder or other...

Concerning

Srikkanth.M

You can run a loop throgh query records of Pentecost an implicit cursor (which automatically manages the open cursor, fetch and next record):

  for rec in (select intime,outtime,barcode,attend_date from dail_att; )
  loop

       t_in :=rec.intime;
       t_out :=rec.outtime;
       t_code :=rec.barcode;
       t_date := attend_date;

    /*

         PUT YOUR CODE HERE ... (if ..then... elsif... logic)
         you can avoid setting variables 'cause you can directly use the implicit cursor variables: rec.intime etc.

     */

  end loop;
END;

In any case, I suggest you check the where the condition of your block... because if not all data is collected it should be a problem in your application... well, even the cursor (if it is based on the same query) will return less data than expected.

Luca

Tags: Oracle Development

Similar Questions

  • How to create the page zero in the apex oracle 4.0?

    Hi all
    How to create the page zero in the apex oracle 4.0?

    Concerning
    Mani

    Hello

    Home > Application Builder > Application xxx > create Page
    There are down to the Center on Wizard Page zero

    Kind regards
    Jari

    Published by: jarola 25 August 2010 19:28

    And here's the chapter on literature
    http://download.Oracle.com/docs/CD/E17556_01/doc/user.40/e15517/UI.htm#BGBFFFGH

  • How to create control provided by PL/SQL ref-cursor

    Dear valuable experts,

    I'm migrating oracle forms10g for JDeveloper. Currently I need a guideline or a reference to create pages of the ADF using the PL/SQL-Refcursor rather then tables or views.

    I need help also how can I create using PL/SQL (package) - Refcursor datacontrol.

    Please help me.

    (!)
    Thank you.
    Zed
    ====

    Zed,

    The Fusion developer's Guide has 35.9.4 article titled "How to create a view object on a REF CURSOR" which should help you.

    John

  • How to use the concepts Advanced PL/SQL in oracle reports and forms

    Hi all

    Can anyone suggest me how to use the Concepts(nested tables,PAA,Varrays,Objects...) Advanced PL/SQL in Oracle forms.

    In fact, I created a Table whose column of type Varray. now, I want to create an element in oracle forms on this field. can anyone suggest me how to proceed.

    Thank you
    Kumar

    Hello

    Take a look at this one:
    http://SheikYerbouti.developpez.com/tutoforms10g/tutoforms10g.htm
    especially the chapter on the block that contains a collection of (2.3.3). The sample is built around a nested table, but you get the idea to adapt to work with a varray.

    Kind regards
    Alex

    If someone useful or appropriate please mark accordingly.

  • How to create insert statements in the SQL Developer client

    Hi all

    A toad, we can create instructions for insertion of data in the table by clicking with the right button on the table and selecting create insert Stmts. But I am new customer SQL Developer. Could you please let me know how to do that in SQL Developer. I would be grateful if someone posts a link to the manual of the SQL Developer (how to use SQL Developer).

    Thank you.
    SQL> create table staging(x int, y varchar2(3));
    
    Table created.
    
    SQL> create table base(x int, y varchar2(3));
    
    Table created.
    
    SQL>
    SQL> insert into staging values(1,'ABC');
    
    1 row created.
    
    SQL> insert into staging values (2,'DEF');
    
    1 row created.
    
    SQL> commit;
    
    Commit complete.
    
    SQL> select * from staging;
    
             X Y
    ---------- ---
             1 ABC
             2 DEF
    
    SQL> select * from base;
    
    no rows selected
    
    SQL>
    SQL> insert into base
      2  select * from staging;
    
    2 rows created.
    
    SQL> commit;
    
    Commit complete.
    
    SQL> truncate table staging;
    
    Table truncated.
    
    SQL>
    SQL> select * from staging;
    
    no rows selected
    
    SQL> select * from base;
    
             X Y
    ---------- ---
             1 ABC
             2 DEF
    
    SQL>
    SQL> exit
    
  • How to create Master records for my laptop Equium A200-15i

    I recently bought a laptop Equium A200-15i. How can I create a CD/DVD Master can I use to restore my computer in the event of a major failure. I know all about the restoration of the machine of the hidden partition, but I want to get my hands on the DVD to use in case of a major failure of the system.

    I took my computer to the local computer store to highlight the fact that ther were no Master DVD as part of the packing list and they seem not very useful. I bought a lot of computers before and normally those two things are provided to the user, or there is a facility for the user to create a. Thanks for your help.

    null

    Hello

    Sorry to hear that, but I hope you can get the original DVD for your laptop. If the PC store will not help you please contact authorized partner in your country and explain the situation.

    They can order one for you.

  • How to create a record behavior to delete?

    http://www.willpower.NET.au/subscribe.txt
    Hi guys. I built a page php above like txt for ease of reading.
    I can't get the record delete behavior to work.
    When an email address is entered in the form, I want to be removed from the database.
    You can see where I have gone wrong?

    Thanks a lot for your help. I have it working now.

  • How to create a document based on the name of a file in the file system?

    Hello

    With lots of photos, I like to have a database to collect information on these photos.

    First question is how to generate a record based on a file in the file system?
    for example, the images are "c:\fotos\2009\01\disc_001.jpg" to "c:\foto\2009\01\dis_98.jpg".
    now, I want to create folders with as one of the attributes of the name of the image (not the image itself). How to create these records (based on information from line-telephony). that is the number of records must be the same as the number of photos.

    any suggestions?
    any response will be appreciated.

    Leo

    Link to create the directory

    http://www.adp-GmbH.ch/ora/SQL/create_directory.html

    You can create a list of files in the directory and read the list of files in this directory.

    [Documentation UTL_FILE | http://download.oracle.com/docs/cd/B14117_01/appdev.101/b10802/u_file.htm#996728]

    [Solution using Java | http://asktom.oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:439619916584]

    SS

  • How to create the mapping for creation of partner

    Can someone help me how to create a record of partner in the sales cloud Oracle? or can someone help me the soap message to create the partner! I was with ICS to integrate the SFDC to CSOS using ICS I need to map the required fields to create the synchronization partner record. We have mandatory fields for the creation of partner OrgName, address, contact details, but if we see the mappings we have three different complex objects < orgParty >, < primaryLocation >, < partner > but the mandatory fields are available in several complex objects how to identify which fields need to map?

    Wrong forum - try asking on the forums - Cloud Computing SaaS Oracle

  • How to create a single installation of DSO on Windows using 11 GR 1 matter?

    Good afternoon

    After having read a lot of documentation and a lot of research on Google, I found a procedure step by step on how install or use ASM for a single database instance successfully. It is using Windows XP SP2, Oracle 11 g 1 material (I can probably adjust any procedure which is intended for Server 2003 or 2008 as long as it is does not require a 64-bit installation).

    If anyone knows where I can find a procedure step by step on how to do it, that actually works, and could be so kind to share, I would very much appreciate it.

    Thank you

    John.

    Oops, sorry John: (.) Yes Yes you are right, I don't have yet an and since me, Amardeep, and two other friends will attend a conference of Oracle, chaos happening here in the hotel :).

    You can use DBCA John, there is no problem. You can use this article as a reference (and can read all the articles by this author as well),
    http://www.databasejournal.com/features/Oracle/article.php/3571371/Oracle-10G-automatic-storage-management-ASM-part-2-sample-implementation.htm

    This flash demo shows how to create the ASM instance,
    http://St-curriculum.Oracle.com/demos/DB/10G/R2/asm_install_diff_home.Viewlet/asm_install_diff_home.swf

    See if that helps.

    Aman...

  • How to create a type of record and a pl/sql table of this record type in the database

    Hello
    I want to create a record type, and then I want to create a PL/SQL table in the oracle 9i database.
    I did block PL/SQL.
    But when I'm doing it in the database it throws me a few errors.
    Could you please tell me how can I do?

    Concerning

    user576726 wrote:
    Hello
    I want to create a record type, and then I want to create a PL/SQL table in the oracle 9i database.
    I did block PL/SQL.
    But when I'm doing it in the database it throws me a few errors.
    Could you please tell me how can I do?

    Concerning

    RECORD type is only supported in PL/SQL for SQL, you must use the OBJECT type.

  • How to create the constructor function for a pl/sql table?

    I created a PL/SQL type as table below:

    create or replace type typ_tbl_des_text is table of the typ_tof_des_text

    OK so far, but I would like to have a constructor function which would be subject to validations and raise_application_error when a validation condition is not met.

    How to do this?

    The typ_tof_des_text that I created with a constructor function, so that the record-level validation are performed in the constructor. And I think the postings between several records shall be made in a constructor for typ_tbl_des_tex, but cannot figure out how to create such a constructor.

    BEDE wrote:

    So, if I have understood correctly, to a plsql table type, I can't have a member procedure. Or can I? I mean, just as for a type of failure I can have one or more constructors and possibly several procedures of Member.

    For the standard tables in PL/SQL, you will need to create your own API (using procedures and functions) to handle beyond the basics provided by the language. No constructors and methods as it is no o - o.

    After thinking a little deeper, I reformulate what I said earlier and actually wants to have a member procedure called add_item, who would be first to check if an item with a key value exists and, if so, it would be up-to-date and so not only extend the plsql table.

    Two options.

    As we already mentioned, an associative array can be considered - note however that this structure of table has name-value pairs.

    Another method is to use a TWG (global temporary table). You define the structure of the once initial table. When a session uses the structure of the table, private copying is instantiated for this session. When the session ends, this copy is destroyed. The table is a temporary structure for this session only.

    It can include indexes and so on – which means you can use the constraints of primary keys, unique indexes, secondary indexes and so on.

    TWG scales are much better than collections or arrays that require a PGA (expensive private server) memory. In addition, SQL can be used natively against a GTT - unlike the arrays and collections.

  • How to pass the Record of entry to the dynamic SQL Code

    Hi all

    I am trying to run under Oracle applications API on the remote database using DB Link. I try to run using dynamic SQL. Part of the code is given below.

    DECLARE

    l_batch_info_rec wsh_picking_batches_pub.batch_info_rec;

    l_rule_id NUMBER;

    l_rule_name VARCHAR2 (240);

    l_batch_prefix VARCHAR2 (240);

    BEGIN

    l_batch_info_rec.document_set_id: = v_document_set_id;

    l_batch_info_rec.order_type_id: = v_order_type_id;

    l_batch_info_rec. Default_Stage_Subinventory: = v_default_stage_subinventory;

    l_batch_info_rec.pick_grouping_rule_id: = v_pick_grouping_rule_id;

    l_batch_info_rec.pick_sequence_rule_id: = v_pick_sequence_rule_id;

    l_batch_info_rec.autopack_level: = v_autopack_level;

    l_batch_info_rec.autopack_flag: = v_autopack_flag;

    l_batch_info_rec.ac_delivery_criteria: = v_ac_delivery_criteria;

    l_batch_info_rec.backorders_only_flag: = v_backorders_only_flag;

    l_batch_info_rec.existing_rsvs_only_flag: = v_existing_rsvs_only_flag;

    l_batch_info_rec.customer_id: = v_customer_id;

    l_batch_info_rec.order_header_id: = v_header_id;

    l_batch_info_rec.from_scheduled_ship_date: = NULL;

    l_batch_info_rec.organization_id: = v_organization_id;

    l_batch_info_rec.include_planned_lines: = v_include_planned_lines;

    l_batch_info_rec.autocreate_delivery_flag: = v_autocreate_deliveries_flag;

    l_batch_info_rec.autodetail_pr_flag: = v_autodetail_pr_flag;

    l_batch_info_rec.allocation_method: = 'I ';

    l_batch_info_rec.pick_from_locator_id: = NULL;

    l_batch_info_rec.auto_pick_confirm_flag: = 'n';         -The value manually to run Transact order

    l_batch_info_rec.autopack_flag: = 'n';         -Manually configure to perform the manual packaging

    l_rule_id: = NULL;

    l_rule_name: = NULL;

    l_batch_prefix: = NULL;

    v_sqlstmt1: = ' START

    wsh_picking_batches_pub.create_batch' | g_db_link | "(1.0,

    fnd_api.g_true,

    fnd_api.g_true,

    : l_return_status,.

    : l_msg_count,.

    : l_msg_data,.

    : l_rule_id,.

    : l_rule_name,.

    : l_batch_info_rec,.

    : l_batch_prefix,.

    : p_new_batch_id

    );

    END;';

    --

    EXECUTE IMMEDIATE V_sqlstmt1

    With the HELP OF THE l_return_status,.

    ON l_msg_count,.

    ON l_msg_data,.

    BY l_rule_id,

    BY l_rule_name,

    BY l_batch_info_rec,

    BY l_batch_prefix,

    OUT p_new_batch_id;

    --

    END;

    After you run this script, I get below error "PLS-00457: expressions must be SQL types ' for variable l_batch_info_rec which is of type record. can someone please guide me how can I pass variable type dynamic SQL record.

    Thank you

    Priyanka

    Food for thought:

    On remote db:

    SQL > create or replace
    package 2 pkg
    3 is
    4 type r_type is (record
    Number 5,
    6 name varchar2 (10)
    7                            );
    (p) 8 procedure
    9 p_rec in r_type,
    10 p_out out varchar2
    11                  );
    12 end;
    13.

    Package created.

    SQL > create or replace
    package 2 body pkg
    3 is
    4 procedure p)
    5 p_rec in r_type,
    6 p_out out varchar2
    7                  )
    8 is
    9 start
    10 p_out: = "ID = ' |" p_rec.ID | 'Name =' | p_rec. Name;
    11 end;
    12 end;
    13.

    Package body created.

    SQL >

    On local db:

    SQL > set serveroutput on
    SQL > declare
    v_rec 2 pkg.r_type@pdb1sol12;
    3 v_out varchar2 (50);
    4 start
    v_rec.ID 5: = 1;
    6 v_rec.name: = 'XXX ';
    7 immediate execution"
    8                        begin
    9 pkg.p@pdb1sol12 (: 1,: 2);
    10                        end;'
    11 using v_rec,
    12 v_out;
    13 dbms_output.put_line (v_out);
    14 end;
    15.
    using v_rec;
    *
    ERROR on line 11:
    ORA-06550: line 11, column 20:
    PLS-00457: expressions must be SQL types
    ORA-06550: line 7, column 5:
    PL/SQL: Statement ignored

    SQL > declare
    2 number of v_id: = 1;
    3 v_name varchar2 (10): = 'XXX ';
    4 v_out varchar2 (50);
    5. start
    6 immediate execution"
    7 report
    8 v_rec pkg.r_type@pdb1sol12.
    9                        begin
    10                            v_rec.id  := :1;
    11 v_rec.name: =: 2;
    12 pkg.p@pdb1sol12 (v_rec,: 3);
    13                        end;'
    14 using v_id,
    15 in v_name,
    16 v_out;
    17 dbms_output.put_line (v_out);
    18 end;
    19.
    ID = 1 name = XXX

    PL/SQL procedure successfully completed.

    SQL >

    SY.

  • How to create a Shell (.sh) file in Oracle using PL/SQL?

    Hello world

    I would like to know how to create a .sh file or any .txt file in Oracle. I would like to get the contents of the file from a table that has different settings. I used bcp in SQL Server and wonder if it's possible in Oracle to create this file.

    Here are the DDL and DML in the table:

    Hello

    With a minor correction, it works on Unix/putty:

    -I assume that you have already created the DIRECTORY (line 01); my directory is on Unix "/ tmp"-you can use on Windows

    CREATE the DIRECTORY DEST_DIR AS 'C:\Users\Julaayi\Desktop\ ';

    -You run SELECT in a variable (ctlCode) and output then the content of this variable in your file.

    -If you have multiple records in the ETL_CTL table, and then use a FOR LOOP.

    CREATE DIRECTORY XX_DIR AS '/tmp/';
    --
    DECLARE
      fileHandler UTL_FILE.FILE_TYPE;
      ctlCode varchar2(2000);
    BEGIN
      fileHandler := UTL_FILE.FOPEN('XX_DIR', 'test_file.sh', 'W');
      select 'scp abcdf@'|| SOURCE_SERVER_1 ||':'|| SOURCE_PATH_1 || EUROPE_1 || EUROPE_NAME
            ||' ' || DEST_SERVER || DEST_PATH || DEST_EUROPE_1
      into ctlCode
      from ETL_CTL;
      UTL_FILE.PUTF(fileHandler, ctlCode);
      UTL_FILE.FCLOSE(fileHandler);
    EXCEPTION
      WHEN utl_file.invalid_path THEN
        raise_application_error(-20000, 'ERROR: Invalid PATH FOR file.');
    END;
    /
    
  • How to create an identifier SQL, sql Profiler

    Hi team,

    An application runs for a long time if I want to create the sql for If sql Profiler for the request. Example is my sql f70m2g5rbfvbg code.

    My question is how to create the sql for the best recommendation Profiler and how to import the sql for acccepting Profiler the best profile for improved performance.

    Please suggest

    Hello

    1. you must accept the best plan based on the recommendations of the Advisor tuning

    2. second thing is to import the profile sql - transport to destination db (where you want to import)

    -Pavan Kumar N

Maybe you are looking for