Count records in cursor

i have a cursor c1. i want to count the record in cursor. i used following code but showing err.
for j in c1
loop
l_count := l_count + 1;
end loop;
error:
the symbol ":=" was ignored.

yash_08031983 wrote:
suppose today there is birthday of 4 employees then birth form open with record of four employee but if there is no employees birthday then no_birth form should be open.I don't think you need cursor here. Normal query should work. For example.
-- Checking the records for current date...
SELECT COUNT(Employee_id)
INTO Variable_Name
FROM emp
WHERE birth_date = TRUNC(SYSDATE);
IF Variable_Name>0 THEN  -- In case if birthdays record found.
  CALL_FORM(...);
ELSE  -- In case no record found for the current date.
  MESSAGE('Your message goes here...');
END IF;
...Now in the called form set the block's WHERE CLAUSE as below...
birth_date = TRUNC(SYSDATE)-Ammad

Similar Messages

  • Displaying count(*) in the cursor record

    Hi,
    I have the following cursor:
    CURSOR inputs_cur IS
    SELECT a, b, COUNT(*) cnt FROM INPUTS
              GROUP BY a, b
              ORDER BY COUNT(*) DESC;
    inputs_rec inputs_cur%ROWTYPE;
    BEGIN
    OPEN inputs_cur;
    LOOP
    FETCH inputs_cur INTO inputs_rec;.
    How can I reference count(*) in the cursor record?
    d_str := inputs_rec.a || ' ' || inputs_rec.b || inputs_rec.cnt ( or cnt) ???
    inputs_rec.cnt ( or cnt) does not display any data....
    Thanks
    Ia

    SQL> Declare
      2      Cursor C1 is Select a.c1 col1,count(*) col2 from
      3      (Select 1 c1 from dual connect by rownum<=10
      4       union all
      5       Select 2 c1 from dual connect by rownum<=20) a
      6      Group by a.c1;
      7  abc c1%rowtype;   
      8  begin
      9       Open C1;
    10       loop
    11       Fetch C1 into abc;
    12       exit when C1%NOTFOUND;
    13          dbms_output.put_line('Record Value: ' || abc.col1);
    14          dbms_output.put_line('Count of record: ' || abc.col2);
    15       end loop;
    16  end;
    17  /
    Record Value: 1
    Count of record: 10
    Record Value: 2
    Count of record: 20
    PL/SQL procedure successfully completed.
    SQL>

  • Is there any limit on how many records a cursor can hold?

    Hi Everyone,
    This is Amit here. I want to know whether there is any limit on how many records a cursor can hold.
    I have a program in which i am creating a cursor and passing it to another procedure as an input parameter. But the count of cursor query is more than 15 Lakhs. The program is running forever.
    Just wanted to know whether the huge data is the problem.
    Thanks ....
    Regards,
    Amit

    user13079404 wrote:
    Just wanted to know whether the huge data is the problem.What do you think? How long does your code typically need to wait for the data to leave the magnetic platter of the harddisk, travel across wires and into the memory buffer of your application - for a single row?
    Now multiply that waiting for I/O time with a million - for a million rows. Or by a billion, for a billion rows.
    Is "+huge data+" a problem? Not really - it simple needs more work to get that amount of data from disk. More work means slower performance. It is that simple.
    Which is why the row-by-row approach used by many developers is wrong. You do not pull a million rows from disk and process it in PL/SQL or Java or .Net. Heck, you do not even pull 10,000 rows like that.
    The correct approach is to think data sets and use SQL to process that for you - and only return the bare minimum of data to the application layer. Maximize SQL. Minimize PL/SQL and Java and .Net.

  • Counting records in Visual Composer

    Hi folks,
    I do have question I cannot find a solution ( maybe due to christmas turkey paralysis )
    I am using VC to call a RFC function in ERP system 'RFC_READ_TABLE' to access data from table.
    The table I access is a customer table containing Delta- Data
    Actually the system RFC function returns all records ( normally between 1 and 10 records).
    On VC side I'd like to display only the number of records to inform if new data is available.
    How can I count records internally in VC?
    ( I do not like to bring in data directly into BI because the application I write will merge BI Query data with non BI data)
    I'D like to use standard RFC function to receive data, but first hand I'd like to decide by number of entries whether to use data or not.
    Any help is appreciated
    TIA

    Hi Prachi,
    that's it.
    I never used that functionality for plain counting records being returned by tables
    It woks perfect.
    The glory shiny points are yours.
    Joerg

  • How to count records from 2 tables and show in RDLC Report

    hi all,
    its being a one day searching for the solution but No Luck.
     I have two SQL tables tblstudetail and tblfeereceiptdetail.
    i just want to count records from both tables and show in RDLC report.
    I tried SQl Query Like This:
    select a.session, a.course,
    Count(CASE a.ADstatus WHEN 'OK' THEN 1 ELSE 0 END ) AS Admission,
    Count(CASE s .I_receiptstatus WHEN 'OK' THEN 1 ELSE 0 END) AS Feeprint
    from
    tblstudetail a
    FULL join
    tblfeereceiptdetail s on s.studentID = a.studentID
    where a.session = '2015' AND s.Fsession = '2015' AND a.adcat = 'Regular'
    GROUP BY a.session,a.course
    ORDER by a.course
    The result Show the Same Value in Both columns
    Session    Course      Admission       FeeDetail
    2015          B.A. I               275              275
    2015          B.A. II              307             307
    2015         B.A. III             255            255
    2015          B.Sc. I             110             110
    2015           B.Sc. II           105            105
    2015          B.Sc. III            64               64
    Actully I want to Count How many ADMISSION have been Taken(FROM tblstudetail) and How many FEE RECEIPT have been Print (From tblfeereceiptdetail).
    please guide me for this as soon as possible.
    thanks in advance...

    I am counting 'OK' in both the table columns I.e 'ADstatus' in tblstudetail and 'feereceiptstatus' in tblfeereceiptdetail
    please suggest me

  • Counting records in crosstab report

    I am very new to the reporting world so apologies if this seems so simple.
    I am trying to understand how count records that meet certain criteria and I am at a loss as to how to make it work (Crystal Reports 2008)
    I am setting up a cross tab report where I am want to count records that vwSubscription.status="Active" AND vwSubscription.isDues=True
    I think I should be creating a Formula Field that tests the status and dues record and when they both meet the correct criteria then have the Formula Field in the Summarized field of the Cross Tab Expert...
    make sense? please help

    Yes. You should create a formula like this
    IF vwSubscription.status="Active" AND vwSubscription.isDues=True THEN
    1
    And in Cross tab Create A Sum  of this field under Summary fields.
    If you want this value to be displayed based on some group, cross tab will be a good option, else you can create a sum of this field and place it in Report header to get the total.
    HTH,
    Jyothi

  • How to count records in a page which are in detail section

    Hi
    Is there a option to count records in detail section and so that based on that can apply a formula.

    Hi
    can i place the below two formulas in section experpt ?
    my report is like
    gh#1 
    details-----which contains transactions related to above group for a country
    group footer#1contains line '--
    if for india there are 3 records in the same page there can be 2 or 3 records in detail section. like that a page can contain more than one country. if number of records are more and coming in next page then the whole section should be moved to new page.
    that is my req. can u suggest accordingly.....
    i want to count the number of records in detais which will vary also how can i put formula when they are going to next page?

  • Mysql database, counting records

    Hi!
    I have to store measured data to MySQL database. During this process I would like to count a number of records in a database table. It is also necessary to filter records. I'm using the SQL statement as follows:
    SELECT COUNT (fieldname) AS cnt FROM table WHERE condition
    Because I haven't got any result I've created a small database "mysweetdb" and table "icecream" to test my VIs (see picture bellow).
    The VI is attached. The result of counting is a 2D array (DB Tools Fetch Recordset Data.VI output) with one element (one row and one column). This element contains no data.
    I usually don't give up easily so I've created a similar MS ACCESS database and counted data in it. I've got a correct answer: 3. So it might be possible that there is something wrong with MySQL driver. But I've created a small Delphi project and I've counted records in MySQL database and MS ACCESS database. Both results were correct.
    Can anyone explain where is the problem in communication between LabView and MySQL database?
    Versions: XAMPP for Windows 1.7.3, LabView Developer Suite 2010 SP1, MySQL 5.1 ODBC driver
    Thanks in advance for your suggestions.
    Attachments:
    Count records.vi ‏19 KB

    ContDivConsult,
    thank you for your answer. An updated version of my VI is attached. It uses two options: LabSQL library and DB Connectivity Toolkit. LabSQL gives correct results.
    Regards,
    Ljubo.
    Attachments:
    Count records.vi ‏25 KB

  • Error: The sort order specified for distinct count records is incorrect

    When processing a measure group with a distinct count measure in it, i get the following error:
    "The sort order specified for distinct count records is incorrect."
    I have no idea what this means - any ideas?

    I had the same problem and your fix worked.  In more detail, the problematic field was contract_no.  I added a named calculation to the table in the Data Source View with the formula CHECKSUM(contract_no).  Then I created the distinct count measure on that named calculation.  And, lo and behold, the errors disappeared! 
    Thank you to Frank.
     - CindyCindy P Hoskey

  • COUNTING RECORDS AND DETERMINING AVERAGES IN REPORT WRITER

    I HAVE 10 GROUPS. I WANT TO BE ABLE TO COUNT RECORDS AND DETERMINE THE AVERAGE DAYS FOR EACH GROUP. I GET DAYS BY SUBTRACTING THE RECEIVED DATE FROM THE RESULT DATE. I WANT TO DETERMINE THE AVERAGE DAYS AND THE NUMBER OF RECORDS IN THE TOP 10%, THE TOP 20%, THE TOP 30%, THE TOP 40%, THE TOP 50%, THE TOP 60%, THE TOP 70%, THE TOP 80%, THE TOP 90%, AND THE TOP 100%. HOW DO I CODE MY LOOP IN PLSQL TO DO THIS? CAN I DO THIS IN REPORT WRITER?

    I am not sure about the exact thing that you are requiring. but you can get the top 100 and top 20 or top 300 etc. by using the ROWNUM function in sql statement.
    thanks

  • Leaf Count Record

    After backing up my hard drive and booting from my freshly made eDrive, I ran TechTool Pro 6's "Volume Rebuild" and after that ran it showed me the results, as usual. There were a few green items but one red. The "Leaf Count Record" went from 1777 to 625. I tried to find out what a Leaf Count Record is by googling it but only count find things on the error associated with this.
    So my first question is: What is a Leaf Count Record?
    Secondly, is there any problem with my Leaf Count going down, and should i be worried about it?
    Note: i went ahead with the rebuild since all the information i could find on Leaf Count Record is mostly about the Leaf Count going up and not down.

    After backing up my hard drive and booting from my freshly made eDrive, I ran TechTool Pro 6's "Volume Rebuild" and after that ran it showed me the results, as usual. There were a few green items but one red. The "Leaf Count Record" went from 1777 to 625. I tried to find out what a Leaf Count Record is by googling it but only count find things on the error associated with this.
    So my first question is: What is a Leaf Count Record?
    Secondly, is there any problem with my Leaf Count going down, and should i be worried about it?
    Note: i went ahead with the rebuild since all the information i could find on Leaf Count Record is mostly about the Leaf Count going up and not down.

  • Invalid Leaf Count Record

    When I repaired my startup disk with Disk Utility, an invalid leaf count record error was reported. From looking at other posts, it appears that one of the recommended things to do for this is trying to repair the issue with Disk Utility. I tried this using Disk Utility 4.1. I replaced my directory with the rebuilt directory. Unfortunately, when I started back up from my install CD and ran Repair Disk, the invalid leaf count record error was reported again.
    Any advice would be much appreciated... maybe I did something wrong.
    Thanks

    First, I realized that I had the error message wrong. I should have wrote "Invalid Leaf Record Count" originally instead of "Invalid Leaf Count Record". I doubt this makes a difference, but just in case there it is.
    Secondly, I am running 10.3.9 and have been doing so for quite some time. My understanding based on this is that DiskWarrior 4.1 should work. I took your advice and tried running DiskWarrior again. As I did previously, I simply booted from DiskWarrior because the disk I am trying to fix is my startup disk. I rebuilt and replaced the directory with DiskWarrior 4.1 again. As a matter of fact, I ran it multiple times while I had it going. I even ran it under the scavenge mode.
    After doing this, I restarted the computer, ejected the DiskWarrior disc, and put in my install disc that came with my iMac. I booted from this CD and reran "Repair Disk" with Disk Utility. The error stills shows up. One thing to note is that my install disc came with 10.3.5 on it. Could this somehow cause a problem? My understanding is that you should always use an install disc for the major OS version you are running to run the "Repair Disk" function of Disk Utility. For example use an install disc for 10.3 if you are trying to repair a disk running 10.3.x or use an install disc for 10.4 if you are trying to repair a disk running 10.4.x.
    Prior to ever running DiskWarrior, I used the fsck command from single-user mode. Interestingly, the error did not show up here. I thought the "Repair Disk" function with Disk Utility was similar to this command, but maybe there is enough variation to cause the difference. Do you guys have any idea, which one I should trust?
    Let me know if any of this is incorrect. Any other suggestions regarding this error would be welcomed. I don't really understand what the error itself means. For now, I guess I will just leave it since I don't really know what else to do. Maybe in the future it will get worse and DiskWarrior will recognize it... I know that's asking for a problem!

  • To find the last record in cursor

    hi
    DECLARE
    vCounter NUMBER;
    -- Other variables...
    BEGIN
    vCounter:=0;
    FOR .. IN cursor LOOP
    IF vCounter=0 THEN
    -- Here open file...
    -- Here write one time data...
    END IF;
    -- Here write cursor data...
    vCounter:=1;
    END LOOP;
    END;
    hi all i am using above code to find the first record.
    if vCounter =1 means its first record.
    Now my question is how to find out the 'n'th record(last record).
    please help me.
    Thanks..

    user13329002 wrote:
    hi
    DECLARE
    vCounter NUMBER;
    -- Other variables...
    BEGIN
    vCounter:=0;
    FOR .. IN cursor LOOP
    IF vCounter=0 THEN
    -- Here open file...
    -- Here write one time data...
    END IF;
    -- Here write cursor data...
    vCounter:=1;
    END LOOP;
    END;
    hi all i am using above code to find the first record.
    if vCounter =1 means its first record.
    Now my question is how to find out the 'n'th record(last record).
    please help me.
    Thanks..create a record type variable to store last record;
    assign the fetch data to that variable
    and when u exit from the loop ,the variable will have the last records value
    since you are using cursor for loop , it will Implicitly open, fetch, exit, and close occur to cursor.
    eg:-
    DECLARE
    type cur_type is  record of yourcursorname%type;
    rec_cur_type cur_type;
    vCounter NUMBER;
    -- Other variables...
    BEGIN
    vCounter:=0;
    FOR .. IN cursor LOOP
    IF vCounter=0 THEN
    -- Here open file...
    -- Here write one time data...
    END IF;
    -- Here write cursor data...
    assign your fetched record from cursor to rec_cur_type
    vCounter:=1;
    END LOOP;
    END;

  • Count records based on detail row containing a null date field

    i need to count the no of rows where a date field is null and print the result in each group footer. the formula isnull works well in details section  but not when I create a running total to count records where evaluate condition is based on a formula and when i test isnull(field) ?
    works in detail section:
    Global NumberVar numOpen;
    if (IsNull({db.DateField}))
    then numOpen := numOpen + 1;
    does not work in group footer?
    IsNull({db.DateField})

    Abhilash Kumar wrote:
    Well, what database are you reporting off and how did you insert a NULL value to the date column?
    In my case, I have worked with Oracle, Access, and now SQL.,
    and have used several different versions of Crysal (but never XI)
    I/we don't put anything into the date...  the field is simply empty and I use 
    IsNull({datefield})
    also for numbers (&currency)
    IsNull({numberfield})
    For text fields I now use
    IsNull({textfield}) or {textfield} not equal ""
    as SQL is a little funny about the empty text fields. Sometimes one works and sometimes the other so I use both.
    Debi

  • Keeping track of count of open cursors

    Is there a way to ask the API for a list of open cursors (or at least a count of) ?

    Hi Linda,
    Again, thanks for the reply.
    Yes, I wanted to use it to manage cursors while closing a database. At the moment I maintain a count of open cursors myself, I do this so that I can manage the close database process.
    I do this if I want to close the database:
    1. Prevent new cursors from being opened (reject all db updates & queries)
    2. Wait till open cursor count is zero
    3. close db
    However, it does mean having to wrap every query/update method in such a way that I can maintain the cursor count. I was setting up a few new databases and was just wondering if i'd missed something in the API to do this for me.
    Thanks,
    Joel
    Edited by: JoelH on 17-Dec-2009 08:57

Maybe you are looking for

  • Cannot perform Automatic Clearing F.13

    Hi Experts, We encountered difficulties to perform automatic clearing for a GL.  This GL is for the purpose of GR/IR clearing account. The system will prompt out the error log "No clearing procedures were carried out". Also we are not possible perfor

  • Nokia 7373 - Security Code Forgotten

    Hi, I can't perform a master reset on my phone or delete contacts from the phone as I seem to have forgotten my security code (although I do still know my PIN so can access and use the phone). So far I have tried the following codes: 0000 1111 12345

  • AddMouseListener disable events of bottom multiple non opaque JPanel

    Hi fellow developpers.. I'm creating an application in which I'm using a JPanel containing multiple JPanel ( a layered system ) with some components laid on them. Everything works fine, events are properly traversing non opaque multiple JPanel, and I

  • Grepping a file for a specific pattern

              I'm trying to use a servlet to mimic a tail/grep operation on a log file. Whilst           I can use a FileReader           to get the contents of a file and put them to a string and display on a browser,           I am only interested in a

  • Cannot give titles to DW template-based pages

    Hi; I'm trying to give titles to my html pages that have been based on a .dwt file, but each time I put in a new title and save, "untitled document" returns as a default. I WAS able to title the index, which was not based on the template. I could det