Increment Dt start with day greater than the Dt at the end of the year Prev in Pro * C

Morning people and greetings from Toronto.

I'm trying to change a Pro * C program. Since ages I touched a Pro * C program but I have made an attempt for her. I would probably need some help andhopefully is the right forum I could nto seem to find any section decicated Pro * C programs.

Here's what its supposed to do. I'm supposed to check if a Start Date of overlap between the start dates and dates from the end of the previous year, and if so, I'm supposed to assign one day Start Date greater than the Date of the end of the previous year.

I have a control panel that stores records for start date and end Date for each year. Here's what I have for 2010.

Start date = 8 May 2010 '; End date = may 12, 2011 'year =' 2010 From now the previous record in the table 1 (where the new record is supposed to be inserted) has a record that looks like this:
DOC_ID     NAME               YEAR         START_DATE     END_DATE
------------------------------------------------------------------------------------------------
999999     Mary Poppins      2009         03-May-2009      08-May-2010
Now, based on the control table, the Start Date for 2010 coincides with the Date of the end of 2009. In this case, I would need to move the start date = may 9, 2010 "(Date of end + 1)

Here is my ProC program in hand
/* Include Headers */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
---------------------------
/* Define constants */
---------------------------
#define  nullterm(string) string.arr[string.len] = '\0';
/* SQL Host Variables */
exec sql begin declare section;
exec sql include sqlca;

 varchar   ctrl_start_date[11];
 short     ctrl_start_date_ind;
 varchar   ctrl_end_date[11];
 short     ctrl_end_date_ind;

 varchar   end_date[11];
 short     end_date_ind;

 int       exist_end_date_flag;
 short     exist_end_date_flag_ind;

exec sql end declare section;


/* Function Prototypes */

void check_date_overlap();


void main(int argc, char *argv[])
{
/* Coding starts here */

void get_ctrl_dates()
{
 exec sql
  select  to_char(trunc(ctrl_start_date),'YYYY/MM/DD'),
          to_char(trunc(ctrl_end_date),'YYYY/MM/DD')
  into    :ctrl_start_date :ctrl_start_date_ind,
          :ctrl_end_date  :ctrl_end_date_ind
  from    control_tb
  where   current_yyyy = :year_number;
}

   check_date_overlap();

   if (strcmp( (char *)run_mode.arr,"N")==0)
   {
    check_date_overlap();
    create_person_rec(); /* This will insert record into person_tb table */
   }
}

/***********************/
/* CHECK_DATE_OVERLAP  */ 
/***********************/
void check_date_overlap()
{

 exist_end_date_flag = 0; /* assume he does not have a record */

 exec sql
  select count(*), end_date + 1
  into   :exist_end_date_flag exist_end_date_flag_ind,
         :end_date :end_date_ind
  from   person_tb
  where  doc_id = :doc_id
  and (( :ctrl_start_date between start_date  and end_date ) or
       ( :ctrl_end_date   between start_date  and end_date ) or
       ( start_date between :ctrl_start_date  and :ctrl_end_date ) or
       ( end_date   between :ctrl_start_date  and :ctrl_end_date ))
  and    year_number = (:year_number - 1)
  group by end_date
  having count(*) = 1;

  /*** Error Check Routine goes in here ***/

  /* Overlapping of dates; Set the Start Date equal End Date + 1 to avoid overlap */
  if (exist_end_date_flag == 1)
  {
   print_to_err_file("The Start Date is overlapping with a previous period.",0);
  }

   nullterm(end_date);

} /* check_date_overlap */
Here would be my question:

My question is, should the SQL above be written like this instead?
/***********************/
/* CHECK_DATE_OVERLAP  */ 
/***********************/
void check_date_overlap()
{

 exist_end_date_flag = 0; /* assume he does not have a record */

 exec sql
  select count(*), end_date
  into   :exist_end_date_flag exist_end_date_flag_ind,
         :end_date :end_date_ind
  from   person_tb
  where  doc_id = :doc_id
  and (( :ctrl_start_date between start_date  and end_date ) or
       ( :ctrl_end_date   between start_date  and end_date ) or
       ( start_date between :ctrl_start_date  and :ctrl_end_date ) or
       ( end_date   between :ctrl_start_date  and :ctrl_end_date ))
  and    year_number = (:year_number - 1)
  group by end_date;

  /*** Error Check Routine goes in here ***/

  /* Overlapping of dates; Set the Start Date equal End Date + 1 to avoid overlap */
  if (exist_end_date_flag == 1)
  {
    /* Is this even correct or would I have to do a strcpy?.
        Also note that I am overwriting ctrl_start_date which
        was fetched earlier in get_ctrl_dates() */
   ctrl_start_date = end_date + 1;
   print_to_err_file("The Start Date is overlapping with a previous period.",0);
  }

   nullterm(end_date);

} /* check_date_overlap */
Published by: Raj404261 on June 10, 2009 11:21

You can put your code between the {code}

As
{code}
your code...
...
{code}

SS

Tags: Database

Similar Questions

  • give meaning to cases where minimum effective_start_date is greater than the current date

    Hi guys, I'm not a developer oracle as such, but I'm trying to get some information from oracle to send to other systems of the company, since we are dealing with oracle HRMS as the master system for employee information.

    In particular, we would like to create people in our training and the security system when they are created in oracle.

    I was told that the oracle per_all_people_f object acts as a slowly changing dimension of type 2, where a person can have several versions, which only is always the current version and the current version can be retrieved using the standard parttern of "date of current between the effective start date and actual end date. So far so good.

    However, I can see there are cases where the minimum 'effective_start_date' is greater than the current date. It is, indeed, equal to their start_date. I guess start_date represents "the first day of work" of the person.

    But this means then there is no "current" information known to people who have not yet really started working for the company again. This seems odd. How can I have someone for whom we have no information "currently correct? I was told that the effective_start_date of the line is automatically set to their "first day of work" date on which the information is entered into the system, IE, the user to enter information doesn't have the ability to say 'this is the current version of the data for that person, who starts at a date in the future. "

    For this reason, I cannot know these new people (who have been entered in oracle, but did not have actually to their first day of work still) training system. But we would obviously get people established in related systems so that they can use all of these systems on their first day of work.

    Have I misunderstood something here? How can there be no correct version for a person at the date and time?

    Hello

    How normally "inform you" the training system on a new person record? If it's a kind of report or an interface, it may be useful changed to examine a number of days in the future, for example + 7

    It is important to understand when you look at an Oracle HRMS instance through enforcement (i.e. the ' front end'), you look at the data on a date date (of the session) - by default, the date is the system date, but it is possible for a user to change this date to be in the future or the past as they see fit. The ability to implement the records in person in the future is a great feature to have, of course, but it must be understood that in this situation, at the date of the day the person's file logically does not exist yet from the point of view of the MFC features. Behind the scenes, however, in the per_all_people_f of the table, the line exist. Similarly, future update of changes to a person (e.g. marital status from Single to married) could be implemented, and the change in status would be visible if the session has been scheduled on a date or after the date of the marriage. As correctly observe you, behind the scenes, the table will hold all historic entries for this person_id with contiguous effective_start_date and effective_end_date beaches.

    Either way, date_start value is not related to as such hiring date; It is actually the value of effective_start_date earlier for the person_id. All changes, regardless of how many or what the effective_start_date is in each case, will always carry this same start_date value. It * may * be identical to the hiring date (certainly the fact that you configure their hire date person records would cause that), but if the person has been created as a postulant effective from 1 September and was then hired has effect from 21 September, column start_date value would be still 1 September. The record of the person would be visible when the current date is on or after this date - the only difference is that they show that an employee until the 21st.

    I hope this helps, but it is possible, that I just confused you more!

    Clive

  • Everytime I open a new window or refresh a getting started with firefox page opens with her. So, whenever I go to my homepage for example getting started with firefox opens along the coast in a separate tab.

    Everytime I open a new window or refresh a getting started with firefox page opens with her. So, whenever I go to my homepage for example getting started with firefox opens along the coast in a separate tab.

    This has happened

    Each time Firefox opened

    == I have this computer.

    You are welcome

  • the new iPad pro films with more FPS than the iPad2?

    the new iPad pro films with more FPS than the iPad2?

    Even as the iPad 2, 30 frames per second - the Pro allows you to make the slow-mo video at 120 FPS

  • Is iMac without retina k 4 at 2.8 GHz with more quickly than the iMac retina 4 k with 3.1 GHz?

    Is iMac without retina k 4 at 2.8 GHz with more quickly than the iMac retina 4 k with 3.1 GHz?

    In most cases you won't see much difference in performance using CPUs unless you do very intensive CPU.

    Maybe you can tell what your needs are for the computer, what you intend to use applications and then we can help suggest some configurations, you might want.

    In today's computers, which makes the greatest performance increases for typical users are (in this order):

    • SSD instead of a Fusion or rotation HD.
    • RAM
    • GPU
    • CENTRAL PROCESSING UNIT
  • How can I burn a movie to a blank dvd when the movie to burn is greater than the amount of space on the blank dvd?

    How can I burn a movie to a blank dvd when the movie to burn is greater than the amount of space on the blank dvd?

    How can I burn a movie to a blank dvd when the movie to burn is greater than the amount of space on the blank dvd?

    You could import the movie into Windows Movie Maker, use the 'split' option, split the video to 2 or more smaller movie files, then burn each smaller movie file to separate DVDs.

    This would be my method. There may be a better way.

    For the benefits of others looking for answers, please mark as answer suggestion if it solves your problem.

  • Namespace 0,0 in the application descriptor file must be equal to or greater than the minimum version 3.1

    Hello everyone

    I followed the link to create app Hello world for the playbook using Flashbuilder 4.6.

    https://developer.BlackBerry.com/air/documentation/ww_air_getting_started/Create_your_first_applicat...

    and I get the following error

    Namespace 0,0 in the application descriptor file must be equal to or greater than the minimum version 3.1 required by Flex SDK. AirHelloWorld-app.xml/AirHelloWorld/srcUnknownAIR application.xml problem.

    Any ideas or suggestions?

    Thank you

    I solved this problem.

    A PC restrated it is resolved.

    Thank you

  • Flex Builder error: Namespace 2.6 in the application descriptor file must be equal to or greater than the minimum version 3.1 required by Flex SDK.

    "2.6 Namespace in the application descriptor file must be equal to or greater than the minimum version 3.1 required by the Flex SDK kit."

    what it means?

    to run the application

    (1) I need lower version 3.1

    (2) I need a newer version than the 3.1

    I'm confused.

    You can change the project xml file. I solved like this.

  • 2.6 Namespace in the application descriptor file must be equal to or greater than the minimum version

    I imported a project mobile fb fb4.6, but this error:

    2.6 Namespace in the application descriptor file must be equal to or greater than the minimum version 3.1 required by Flex SDK.

    Is there a quick fix for this?

    you need to replace http://ns.adobe.com/air/application/2.6 "> to http://ns.adobe.com/air/application/3.1" > inside *-app.xml file. ""

  • ORA-22813: value of the operand is greater than the limits of the system

    Hello
    for small query

    SQL > select COMPLETION_TIME from RC_BACKUP_FILES WHERE ROWNUM < 2;

    I get

    ORA-22813: value of the operand is greater than the limits of the system

    It seems starnge to me, you know?

    I have a great value operand?

    Thanks for help.

    The Version could help here

    might be a bug

  • My description of bug with examples is greater than the limit of your comments, where can I post it then?

    I was going to send a bug report via but the system rejected it because of its size. The report is the following:

    "
    There is a bug that occurs when I delete the symbols quickly with a virtual keyboard:

    for example, if I start to remove the third line of the

    • a little weird right down here
    • Cat'o 'dog' or ' other '.
    • We will remove this
    • We will remove this
    • I don't like her, not a single bit

    from the end of the line of right in this feedback message field, sometimes I will get (after some pressure from BACKSPACE):

    • a little weird right down here
    • Cat'o 'dog' or ' other '.
    • Let'sthis
    • We will remove this
    • I don't like her, not a single bit

    then the cursor jumped to the Middle, and sometimes the line break is eaten, so I'm

    • a little weird right down here
    • Cat'o 'dog' or ' other '.
    • We're going to delet * doesn't, not a single bit

    (here, I deleted the third line, then started with the fourth).

    The bug depends on the speed of deletion. The pre-installed on Asus eee Asus virtual keyboard slider is used, but such a but only occurs in other applications, I have not noticed that even in beta version of FireFox 11.0.
    "

    Is it OK to post here? Or there is some place better?

    PS the bugs seem to happen the same way in this text box.

    The latest version of Firefox Mobile is 10, but there an Aurora version 11. Allow installation of software from sources non-market and try to install the version in the link I gave you above.

  • Deny access to my SkyDrive workbook error: "workbook is greater than the maximum size of workbook can be opened in the browser.

    Original title: deny access to my workbook to SkyDrive

    I have a workbook stored in SkyDrive that I share with several co-workers. We had no problem sharing the workbook for the last two weeks, but this morning, we are all getting an error message saying "Workbook is larger than the maximum size of workbook can be opened in the browser" and cannot access it at all. It's a very important workbook we need on a daily basis at work, then I would greatly appreciate any advice you could provide!

    Thank you
    Samantha

    Hello

    Because the problem is related to SkyDrive, I suggest you to report this problem in windows live support team.
    http://windowslivehelp.com/product.aspx?ProductID=6

  • Selection of records that are greater than the current week or

    Hi I have a table with the table structure

    CREATE TABLE OMPPRODUCTION
    (
    LOCATIONID VARCHAR2 (200 BYTE) NOT NULL,
    IPC VARCHAR2 (200 BYTE) NOT NULL,
    PRODUCTIONWEEK VARCHAR2 (200 BYTE) NOT NULL,
    QUANTITY VARCHAR2 (2000 BYTE),
    PRODUCTIONCODE VARCHAR2 (2000 BYTE),
    MOULDQUANTITY VARCHAR2 (2000 BYTE),
    VARCHAR2 (2000 BYTE) SOURCE,
    VARCHAR2 (2000 BYTE) APPLICATION,
    COMMENTS VARCHAR2 (2000 BYTE),
    DATE OF TLM,
    ADSTAT CHAR (1 BYTE),
    SID NUMBER (10, 0),
    SECURITYLEVEL VARCHAR2 (100 BYTE),
    ENABLE CONSTRAINT PRIMARY KEY (LOCATIONID, CPI, PRODUCTIONWEEK) OMPPRODUCTION_PK
    )

    He has field PRODUCTIONWEEK that is to be given YYYYMMDD.

    I want to select records that are starting the week underway (Monday as departure day).

    for example, the date is 20120210 so I would choose the lines including the date more or equal to 20120206.

    Can someone guide me how it is possible?

    Published by: MaheshGx on 6 February 2012 16:16

    MaheshGx wrote:
    Select * from OMPPRODUCTION where to_number (to_char (to_date (productionweek, 'yyyymmdd'), 'WW')) > = to_number (to_char (sysdate, "WW"))

    Wow, why so complicated?

    You work with dates, so:

    (a) why the hell you store dates in a column VARCHAR2? (and worse yet, why is 200 bytes of length)? Store dates as the DATE. The optimizer based on CSSTidy will thank you. As well, you know, you won't be wasting space.
    (b) compare with the dates, not dates-converted dates - dates-converted-to-number numbers. Why do extra work when you have not to?

    Since you're after weeks from Monday, I'd go for the format mask "IW", since it is fixed and will always return the Monday of the current week ("WW" could return Sunday or Monday, depending on what are your NLS settings.) I'd rather have my labour code for those who executes it, regardless of their NLS settings).

    So, given the fact that your column is not the DATE data type, it would be more effective for you;

    select *
    from   ompproduction
    where  trunc(to_date(productionweek,'yyyymmdd'), 'iw') >= trunc(sysdate, 'iw');
    

    If you have an index on productionweek that you need help in this query, then I suggest to convert it to a basic index function.

  • iCloud library greater than the Mac library

    I have in my original photo library with all photos Mac and the size is about 108 GB. After activating iCloud photo library, I see that the same library iCloud is about 202 GB! In my Mac, I have the ability to download all the photos in original quality.

    I also see that, in the two libraries, the amount of photos and videos is the same. So my question is why is the iCloud photo library so much bigger and what can I do to reduce it to the same size as the local library.

    The library in iCloud should be less than the library on your Mac, unless you do not use storage optimize or the Mac is still downloading iCloud.  You see a progress bar in Photos > Preferences > iCloud Panel?

    In my Mac, I have the ability to download all the photos in original quality.

    Have you turned it on recently?

    You synchronize iCloud photo library with multiple devices?

  • Outlook 2007 backup file is greater than the source file. Why?

    My Outlook pst data source personal folders file using 2.4 GB.  The backup file (by using the backup tool) uses 5.4 GB.  Why the difference?  I back up all my data on a hard drive to FAT 32 format, which will not accept a file greater than 4 GB, so I'm not able to save Outlook backup file given its current size.

    Hello GaryCalgary,

    Thanks for visiting the site of the community of Microsoft Windows XP. The question you have posted is related to Outlook and would be better suited to the community of Office Discussion groups. Please visit the link below to find a community that will provide the support you want.
    Outlook General Questions Discussion Group

    Steven
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think

Maybe you are looking for

  • Satellite 1805-S274: cannot reformat using the recovery CD!

    I'm trying to reformat my computer laptop 1805-s274 Toshiba, using the Toshiba Recovery disk, but it won't work! The computer made an attempt to play the disc (which is in good condition, not damaged).It goes to the "Welcome to Toshiba Recovery Utili

  • I have deleted the HP Smart Web Printing (but kept the link) and now I don't know how to get it back.

    I had Microsoft Updates-ITMU 23 and 12 did not update. I am 73 and not very computer. I finally (discovered by chance) at least part of the problem, is that I must have installed Explorer 9. He told me to update to a new driver/software. I tried to d

  • Access to the new data in Event Message user callback?

    I use the Simple OI LabVIEW as a template for my user interface for TestStand. The sequence sends a Message to the user to the IO to the string array of tests to run. But I'm having a lot of difficulties this string data in table for the VI event rem

  • HP Pavilion DV6-6112sg drivers

    Hello! I have a HP Pavilion DV6-6112sg and I want to update all its drivers, but I'm very bad with it (2 days ago, I tried to update the audio driver, and I had to reinstall the system, because I couldn't get the sound back...) I found this part of t

  • Why is the trigger of the DAQ signal works not as I expect?

    Using the DAQ Assistant, I have received a signal at a rate of 100 k Hz and number of samples of 75 k. I would like a light every time that the amplitude of the signal falls below 1. As you can see from my attached graph, the amplitude becomes less t