Reg: Fetching default value -

Hi Experts,
Need some help in writing a query.
Table 'Tab_2' has column 'c3' which checks for its value from 'tab_1' column 'c1' values, and accordingly fetches value from column 'c2'.
But if a value from c3 is not present in tab_1 column 'c1', it should default 'c2' value as 'dx'.
Please find below the Create & Insert scripts:
create table tab_1(
    c1 varchar2(200Char),
    c2 varchar2(200Char)
create table tab_2(
    c3 varchar2(200Char),
    c4 varchar2(200Char)
insert into tab_1 values('104,113,146,165','1x');
insert into tab_1 values('204,213,246,265','2x');
insert into tab_1 values('304,313,346,365','3x');
insert into tab_1 values('default','dx');
commit;
insert into tab_2 values('146',null);
insert into tab_2 values('265',null);
insert into tab_2 values('333',null);
commit;Here's query where I'm stuck:
SQL> with x1 as
  2  (
  3      select
  4          REGEXP_SUBSTR(c1,'[^,]+',1,level) id1,
  5          c2
  6      from tab_1
  7          connect by level <= length(translate(c1,'~0123456789','~'))+1
  8          and prior c1 = c1
  9          and prior sys_guid() is not null
10          and c1 != 'default'
11  )
12  select
13      id1, c2, c3
14  from x1 RIGHT OUTER JOIN tab_2
15      on (x1.id1 = tab_2.c3);
ID1        C2         C3
146        1x         146
265        2x         265
                      333Please let me know if any further clarification is needed.
- Ranit

The data model looks flawed. So not sure the following solution will satisfy all the issues with respect to your problem.
with t
as
select regexp_substr(c1, '[^,]+', 1, level) c1
      , c2
   from tab_1
connect
     by level <= length(c1) - length(replace(c1, ',')) + 1
    and c1 = prior c1
    and prior dbms_random.value() is not null
select t1.c3, t2.c1, nvl2(t2.c1, t2.c2, (select c2 from tab_1 where c1 = 'default')) c2
  from tab_2 t1
  left join t t2
    on t1.c3 = t2.c1;Edited by: Karthick_Arp on May 22, 2013 12:39 AM
Changed NVL to NVL2

Similar Messages

  • Reg: Default value option - is it for value mapping????

    Hi,
    Recently i had seen an option of mapping a default value or error out the message when value mapping (???) doesnt fetch the conversion.  I'm confused if i'm referring to value mapping or any such functionalitywhich comes as a standard pack....certainly not the options u have in recv determination. Can anyone pls enlighten on what it is exactly. I'm left clueless as i barely remember where i got to see tht option from.
    Note: def not the default node in mapping too
    thanks
    P.S

    Recently i had seen an option of mapping a default value or error out the message when value mapping (???) doesnt fetch
    the conversion
    Where can he find the option Map with Default value OR error-out the message ..... is it in Value Mapping or in some other functionality
    Regards,
    Abhishek.

  • Default value don't get displayed for Fetch XML report

    Hi All;
    i have a date parameter in a fetch XML report 
    i set its default value as 01/01/2010 
    when i run this report in SSRS i can see the default value of the date
    But when the same report gets displayed on CRM 2013 online - report section the date default value dont get displayed
    Any help for this much appreciated
    Thanks
    Pradnya07

    Hello Zero-G. _,
    >> But I don't get any "Operation". I can't see my failure. - I tested around for the last few days, but I don't have a Clou, what's wrong...
    I am afraid that you have mixed the WCF and WCF Data Service, here is a WCF Service example(it works with the Entity Framework while it is not WCF Data Service):
    http://www.codeproject.com/Articles/127395/Implementing-a-WCF-Service-with-Entity-Framework, please check it, in your case, you are use this mode and you do not need to create WCF Data Services.
    If you want to write a custom method in WCF Data Service, you could refer to this link:
    https://msdn.microsoft.com/en-us/library/dd744841(v=vs.110).aspx, as you can see, although if we declare a custom method, it would not show in the web browser, we call it as adding
    the method after the based service link directly:
    http://localhost:12345/Northwind.svc/GetOrdersByCity
    Or call it by using a client project which could detect this method and call it as in this blog:
    http://blogs.msdn.com/b/dataaccesstechnologies/archive/2009/12/01/way-to-expose-custom-method-in-an-entity-class-from-wcf-data-service.aspx
    Regards,
    Fred.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Define Default Values for Value Categories-reg

    Hi Experts,
    What will be the effect in cost tab in MO,if I dont maintain the Define Default Values for Value Categoriesin SPRO.Because by just maintaining Value categories and its cost element assignment,Iam getting the planned and actual cost in cost tab of order.
    Pl clarify.
    regards
    KRISHNAN

    hi..
    Yes,u r right..without assigning default values also u can get the P/A cost in PM order.But,Suppose u have created 4 different value categories,ex-
    Mech Spares
    Elect Spares
    Civil Spares
    Maint Services
    and u are assigning all these as default value categories,if ur maint order has only cost against mech spares it will show the cost incurred against that and cost against other value categories will be shown 0 in cost overview..
    u can try it!!!

  • How to change default value of a parameter and LOV attached to a parameter

    Hi All
    I am new to discoverer reports and I need to accomplish the following tasks:
    1. Need to change the SQL query of a discoverer report
    2. Need to change the default value of parameter ( from constant to current month). In the discoverer plus responsibility when I open the report and go to tools>>parameter>>edit
    I can see the constant default value given there. On the right hand side there is a drop down which says 'Value'. I guess if i need to put a SQL as defaul value I need to change the drop down to sql or something and then put the SQL. Problem is the drop down is froezen and I cannot change it.
    Even if I try to create a new parameter/report.
    3. Need to change the LOV associated to the item on which the parameter is based.
    I have the discoverer plus responsibility attached to myself and do not have the discoverer administrator tool (desktop developer tool like forms 6i). My questions are:
    1. Can I change the SQL query by using discoverer plus responsibility or do I need discoverer administrator tool?
    2. Any help on how to get the default value from an SQL query? currently it is a constant value.
    3. Is there any way to figure out is the LOV is madeup of fixed constant values (like independednt value set) or they are fetched from some sql query(table validated value sets)?
    Any pointers/solutions will be highly appriciated!!!
    Thanks in advance.
    Thanks and Regards,
    Shashank

    HI,
    Need to change the SQL query of a discoverer reportThe discoverer generate the SQL according to the item, calculation and conditions designed in the worksheet.
    You cannot edit a specific worksheet SQL.
    In order to change the SQL you need to change the worksheet using the "Edit-> worksheet" from the menu.
    To change the SQL generated inside the folders you need to do that using the administrator.
    Need to change the default value of parameterYou cannot use SQL statements for the parameter default value. it is not supported. if you need default you can use only constant (as it was). otherwise you can set the parameter to be optional and then add to this condition an OR saying that <item>= NVL(:Parameter,<your default>)
    as <your default> you can use calculations so that if for example you want the current date you will create a calculation containing: SYSDATE.
    Is there any way to figure out is the LOV is madeup of fixed constant values (like independednt value set) or they are fetched from some sql query(table validated value sets)?They are based on SQL, even they are const then you will see it as
    select 'a','b'... from dual
    you can find the LOV (called item classes) in the administrator.
    Go to the item your condition is based on and see its properties.
    In the properties you should see the item class it uses.
    Close the properties and go to the item classes tab, search for this item class and figure the folder it came from.
    This is the folder you need to change in order to change the LOV.
    Hope it helped a bit, you sure asked several big questions...
    Tamir

  • How to include a default value in Dynamic cascading prompt from 2nd Level.

    Hi,
      I use Command Object in 'Datbase Expert' to create 'Custom Tables'  and use these tables to fetch LoVs. I use Dynamic Cascading Prompts in the reports.  I have a peculiar requirement using DCP.
      There are Four Levels as in the Example:
      Continent
       Country
       State
       City
      In the Custom Table, requirement is to create an additinal row with '' that represents 'All Values selected' for that level starting from second.  and The default selection should be '' . I defined that '*' means 'All Vales Selected in the report' This si not a problem. But the problem how to show a default value in a Dynamic Cascading Prompt i.e. how we can make sure in an default value can be selected in DCP from Second Level?
    how can the examples 1,2,3 can be achieved detaisled below beacsuse we need to show a default value in Casacading Propmt
    Eg of Schedules with DCP:
    Schedule 1   
      Continent: Europe
       Country: *
       State: *
        City:  *
      Schedule2:
       Continent: Europe
       Country: England
        State: *
         City: *
    Schedule 3:
        Continent: Europe
       Country: England
        State: Greater London
         City: *
    Schedule 4:
    Continent: Europe
       Country: England
        State: Greater London
         City: City of london

    You won't be able to have a true "default" value in the various cascading levels, since there aren't default values in a dynamic cascading parameter.  That being said, I've created a sample report in Crystal Reports 2008 that has a Command-driven DCP with '*' values for the 2nd and 3rd levels of my 3-tier DCP and have accounted for them in the record selection criteria.  You can find the sample here at https://www.box.net/shared/mav5qp337j

  • Field 'record_EMP_ID' doesn't have a default value

    I solved org.hibernate.TransientObjectException by adding "@OneToMany(fetch=FetchType.EAGER, cascade=CascadeType.ALL)"
    But this time values can't be inserted to DB.
    OS : Windows 7
    JDK : JDK 1.6
    JBoss : JBoss 5.1.0.GA
    DB : MySQL 5.5
    Error is "Field 'record_EMP_ID' doesn't have a default value"
    - Members.java
    @Entity
    @Table(name = "family")
    public class Members implements Serializable {
    @Id
    @Column(name = "EMP_ID")
    private String id ;
    @Column(name = "EMP_Passwd")
    private String passwd ;
    @Column(name = "EMP_Name")
    private String name ;
    @OneToMany(fetch=FetchType.EAGER, cascade=CascadeType.ALL)
    @JoinTable(name="info", joinColumns = {@JoinColumn(name = "EMP_Name")})
    private Collection<Records> record = new ArrayList();
    ....getter and setter
    - Records.java
    @Entity
    @Table(name = "info")
    public class Records implements Serializable {
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    @Column(name = "EMP_ID")
    private int i;
    @Column(name = "EMP_Name")
    private String name;
    @Column(name = "EMP_Bank_Account")
    private String account;
    @Column(name = "EMP_Hobby")
    private String hobby;
    @Column(name = "EMP_Phone")
    private int phone;
    ...getter and setter method
    in jsp file I invoke EntityManager.persist
    Context ctx = new InitialContext();
    IMappingTestPort port = (IMappingTestPort) ctx.lookup("MappingTestBean/remote");
    Records r = new Records();
    r.setName("aaa");
    r.setAccount("111-2222");
    r.setHobby("bbb");
    r.setPhone(021112222);
    Members m = new Members();
    m.setId("aupres");
    m.setPasswd("aaa");
    m.setName("ccc");
    m.getRecord().add(r);
    port.setFamilyMember(m); // This EntityManager.persist method
    But it failed.
    In console
    20:21:29,233 INFO [STDOUT] Hibernate: insert into family (EMP_Name, EMP_Passwd, EMP_ID) values (?, ?, ?)
    20:21:29,268 INFO [STDOUT] Hibernate: insert into info (EMP_Bank_Account, EMP_Hobby, EMP_Name, EMP_Phone) values (?, ?, ?, ?)
    20:21:29,288 WARN [JDBCExceptionReporter] SQL Error: 1364, SQLState: HY000
    20:21:29,288 ERROR [JDBCExceptionReporter] Field 'record_EMP_ID' doesn't have a default value
    record_EMP_ID is automatically generated by hibernate
    Pls help!

    An update: 
    New virtual machines created after the integration is in place is visible in Virtual Machine Health Dashboard. No other dashboards seems to contain any data.

  • How to use copy default values for material from vendor master in Account Group

    Dear all:
       In define AccountGroup for vendor ,there is a field named DURAS which means default values,who can tell me how to use it?
       Any informations are appreciated!

    Hi Katherine,
    I have tried using default value as B in the customizing
    If i maintain default values in the vendor master record, it will automatically adopt in the purchase info record.
    Here i tried using sales person & telephone no field in vendor master record & it automatically adopts to purchase info record.
    Region sales person and telephone no i have maintained in vendor master record, it automatically fetches to info record for the particular account group. I am not sure if there is any relation between vendor master and material master record.
    Regards
    Subbu.

  • Settin' default value of a lov depending on the value of another lov

    hi all,
    here is my problem:
    I got two combobox item in my form;
    the first one is customer_id,
    the second one is seller_id,
    what i wanna do is:
    when selecting one customer_id, i want to set the value of the seller_id to the one associated with this customer, and give the enduser to change this value;
    i'm tryin' to do so with bind variables but it doesn't work!
    any help.;
    thanks in advance

    Hi,
    ok got your requirement clear ,see what all you have to
    First of I make clear that by frame what I ment was that when you are in the design phase of the
    and you are in the section of "formating " ,there you have 2 frames which are basically not visible as frames,
    so just forget about that.
    I have implemented the same thing in the emp table intead of your
    your customer_id and the supplier_id.
    I'm assuming that you will be having just one record in the second LOV corresponding to the
    first LOV.
    What I've done is that I have made an entry in the scott.emp table with deptno 40 so that
    for deptno 40 I have just 1 entry ,to simulate your case.
    Note:
    Customer_id type is combobox the lov is LOV_CUSTUMER (this will be equivalent to my DEPT_NO LOV)
    seller_id type is combobox too, the lov is LOV_SELLER (this will be equivalent to my EMPNO_NO LOV)
    1)My driving LOV is in deptno field.
    2)I have the driven LOV in empno field.
    3)Now when I select Operation dept (dept no 40),I get the selected value in the LOV (empno)
    and also rest of the empnos.
    This is how you can achieve the functionality as said by you.
    1)In your second LOV write some thing similar.
    select ENAME, EMPNO from SCOTT.EMP where deptno = :deptno
    union
    select ENAME, EMPNO from SCOTT.EMP where deptno != :deptno
    this is to ensure that you get all the values and at the same time
    are able to use the binding of the second LOV.
    2)In the before display section write something similar.
    declare
    l_empNo varchar2(3000);
    l_deptNo number(4);
    begin
    -- This deptno shows what you selected from the first LOV.
    l_deptNo := p_session.get_value_as_NUMBER(
    p_block_name => 'DEFAULT',
    p_attribute_name => 'A_DEPTNO',
    p_index => 1);
    --just check  wheather it returned something,at the time of loading it will not return anything,so simply
    --return in that case without doing anything.
    if(l_deptNo is null) then
    return;
    else
    --This query basically fetches the value for your second LOV.
    select empno into l_empNo from scott.emp where deptno = l_deptNo;
    --set the value for the second LOV in the session.
    p_session.set_value(
    p_block_name => 'DEFAULT',
    p_attribute_name => 'A_EMPNO',
    p_value => to_number(l_empNo));
    end if;
    end;
    please try to understand the relationship in my scenario and your scenario.
    Hope this helps.
    rahul

  • Set Default Values in Listbox with Dialog Programming

    Hi all,
    I am stuck with a problem i.e  I am working with Dialog Programming Screen
    where i have to set default values in some n numbers of Listbox which i have created on Screen.
    This default value is needed to be fetched from database table.
    I am using single table. Hence no confusion that i have to first fetch data from 1st listbox then corresponding data is fetched into second & so on ..NO NO This is not required.
    Simple one screen which will update a table in database, where  some fields on the screen needs to be default set as per tables domain default values set while table creation.
    Please help me out in this.
    Thanks & Regards,
    Sandhya.

    Please search SDN, before you post a new forum from next time... any ways just follow the below code..
    u need to use the FM 'VRM_SET_VALUES' to implement list box in module pool. Check the below code. u have to write this code in PBO..
    if c = 0.
    select land1 landx from t005t into table wi_country.
    sort wi_country by land1.
    delete adjacent duplicates from wi_country comparing all fields.
    loop at wi_country.
    wa_ctry-key = wi_country-land1.
    wa_ctry-text = wi_country-landx .
    append wa_ctry to wi_ctry.
    endloop.
    call function 'VRM_SET_VALUES'
    exporting
    id = 'ZCUST_MASTER1-COUNTRY'
    values = wi_ctry
    exceptions
    id_illegal_name = 1
    others = 2
    if sy-subrc 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    c = 1.
    endif.
    Hope this helps u,
    Regards,
    Rajesh

  • Set Default value in dropdown box.

    I used selection= "Default Value" in dropdown box to do this functionality.But when i selected other value it is
    selecting the default value and saving also.but i want that page initiated the default value should be there and user can select other values and save.
    Please give me solution for that as soon as possible.
    Thnks in advance.

    Actually i m using the following code and it is fetching value from a table.Can u understand this code n provide me solution for default value.
    <htmlb:gridLayoutCell columnIndex       = "5"
                                  rowIndex          = "2"
                                  colSpan           = "1"
                                  wrapping          = "FALSE"
                                  verticalAlignment = "TOP" >
              <htmlb:dropdownListBox id                = "unitDropdownListBox"
                                     table             = "<%= IT_MSEHI %>"
                                     nameOfKeyColumn   = "MSEHI"
                                     nameOfValueColumn = "ZMSEHI"
                                     onSelect          = "setunitValue"
                                     disabled          = "<%= LV_MODEITEM %>"
                                 selection         = "<%= it_item-unit %>" />

  • How to set default value to date type attribute.

    Hi,
    How to set default value to date type attribute.
    E.g I want to set u201C01/01/1999u201D to date attributes.
    First i want to set value and then i want to fetch the same & want to check equals.
    please suggest solution.
    Regards,
    Smita

    Hi,
    In wdinit() method u can set the date
    DateFormat df = new SimpleDateFormat("MM/dd/yyyy");
    Date today = Calendar.getInstance().getTime();
    String reportDate = df.format(today);
    wdContext.currentContextElement().setFromDate(reportDate);
    Another way you have set the this formate like that
    1. Create a Simple type under "Dictionaries->SimpleType" called DateFormat
    2. Select the type as "date"
    3. Go to the "Representation" tab and set the format as "dd/MM/yyyy" (or whatever u want, but month should be MM)
    4.Bind the context attribute to the type created now.
    Hope this helps u.
    Best Regards
    Vijay K

  • Default value updation in table

    Hi,
        I want to update default value 'X' in ztable field through report.How to set the field value always containing X only.

    Hi Anitha,
    Can you a bit clarify your question ? - I understand if the ZTable field value is 'X' you need to update it right ?
    Then , fetch the entries of the tables for which the field values is 'X' and modify the field value as per the business requirement and update the same table. You can use the work areas while updating the ZTable.
    Thanks,
    SK

  • Setting Default value with SQL Query as Data Model

    Hi All,
    I am developing report based on SQL query.date set as 'SQL Query'. I have created two params start-date and end-date. I am fetching records from database between these two dates.
    I want to populate sysdate as a default values. I do not want to use datatemplate approach i mean using beforeReport trigger.
    Thansk,
    Vara

    Hi Vara,
    To set the default value for one of your parameters to SYSDATE you need to enter:
    {$SYSDATE()$}
    in the Default Value text box
    Is this what you require?
    Cheers
    Andy

  • Problem fetching multiple values in a TIMESTAMP column

    Hi all,
    I'm having a problem trying to fetch multiple values in a TIMESTAMP column. I can successfully fetch the TIMESTAMP column if I do the following:
    OCIDateTime tstmpltz = (OCIDateTime )NULL;
    rc = OCIDescriptorAlloc(p_env,(dvoid **)&tstmpltz, OCI_DTYPE_TIMESTAMP,
    0, (dvoid **)0);
    rc = OCIDefineByPos(p_sql, &p_dfn, p_err, 1, &tstmpltz, sizeof(tstmpltz),
    SQLT_TIMESTAMP, 0, 0, 0, OCI_DEFAULT);
    This works fine. I can then do what I want with the OCIDateTime variable tstmpltz, like convert it to a text string, etc.
    But what I am trying to do is fetch many rows of data that could include a TIMESTAMP column. For character columns this is no problem. I simply allocate a buffer of the correct width and length and then do my OCIDefineByPos to point to the start and the character data gets filled in. Same for numeric columns as well.
    I can do this with a TIMESTAMP column if I do the OCIDefineByPos with a column type of SQLT_CHR. But the problem I'm running into when I do things this way is if I fetch a Timestamp value that is before 1950 I believe it is, I get back the wrong century. So for instance 1900 comes back as 2000. I think this is because the default date format when fetching is a 2 digit year. So I've tried to the do following:
    long fetchrows = 50;
    unsigned char *descpp1;
    descpp1 = (unsigned char *)calloc(fetchrows, sizeof (OCIDateTime *));
    int i;
    for (i = 0; i != fetchrows; i++)
    /* Allocate descriptors */
    rc = OCIDescriptorAlloc((void *)p_env,(void **)&descpp1[i * sizeof (OCIDateTime *)], OCI_DTYPE_TIMESTAMP,
    0,(void **)0);
    // Bind the column
    rc = OCIDefineByPos(p_sql, &p_dfn, p_err, 1, descpp1, sizeof(descpp1),
    SQLT_TIMESTAMP, 0, 0, 0, OCI_DEFAULT);
    rc = OCIStmtExecute(p_svc, p_sql, p_err, (ub4) 50, (ub4) 0,
    (CONST OCISnapshot *) NULL, (OCISnapshot *) NULL,
    OCI_DEFAULT);
    And I get an "ORA-01403: no data found" error. I'm missing something here but I can't figure out what it is. Is this proper way to fetch multiple Timestamp columns ?
    Thanks,
    Nick

    Hi Nick,
    I think the "trick" here is that when you call OCIDescriptorAlloc normally you would pass a pointer to an OCIDateTime pointer (i.e. OCIDateTime**). However, you're being sneaky here and using unsigned char * with malloc/calloc for the reasons you have already mentioned. So, that changes things a bit because in this scenario the "destination address" where OCI is going to put the address for the OCIDateTime descriptor is in the memory you have dynamically allocated rather than in the target pointer of an OCIDateTime** declaration. So far so good, but the problem, as you've discovered, comes about when you need to get the OCIDateTime* to pass into the OCIDateTimeToText function. In your call you have this:
    (OCIDateTime *)descpp1[0 * sizeof (OCIDateTime *)]However, that isn't the address of the descriptor it's a pointer to the address so, depending on your actual calls, etc. you'll either get a memory violation or an invalid OCI handle error. What you can do is get the address from that memory location and stuff it into a proper OCIDateTime* and then it can be used in the OCIDateTimeToText function.
    I'm probably doing a terrible job explaining it, but I have cobbled together a sample which does what you want (at least as far as I can tell). Of course, being OCI, there's a fair bit of code, but here's the main parts.
    I created a table called "ts_test" that has the following structure and sample data:
    SQL> desc ts_test
    Name             Null?    Type
    TS_ID                     NUMBER
    TS_VALUE                  TIMESTAMP(3)
    SQL> select * from ts_test order by ts_id;
         TS_ID TS_VALUE
             1 01-JAN-09 08.00.00.123 AM
             2 01-JAN-09 12.34.56.789 PM
             3 01-JAN-09 04.46.00.046 PM
             4 01-JAN-09 10.00.00.314 PM
    4 rows selected.I use the same query as above in the OCI sample code to get the values back out of the table.
      ** will hold pointers to TimeStamp Descriptor memory
      unsigned char *pTSD = (unsigned char *) NULL;
      ** temp pointer used with descriptors
      OCIDateTime *pTemp = NULL;
      ** allocate memory for the ts_id column
      if ((pID_val = (ub4 *) malloc(sizeof(ub4) * arrsize)) == NULL)
        printf("Failed to allocate memory for pID_val!\n");
        return;
      ** allocate memory for the ts descriptors
      if ((pTSD = (unsigned char *) malloc(sizeof(unsigned char *) * arrsize)) == NULL)
        printf("Failed to allocate memory for pTSD!\n");
        return;
      ** allocate date time descriptors
      for (i = 0; i < arrsize; i++)
        rc = OCIDescriptorAlloc(pDBCtx->envhp,
                                (void **) &pTSD[i * sizeof(OCIDateTime *)],
                                (ub4) OCI_DTYPE_TIMESTAMP,
                                (size_t) 0,
                                (void **) 0);
      ** define the first column in the results
      rc = OCIDefineByPos(stmtp,
                          &defnp,
                          pDBCtx->errhp,
                          (ub4) 1,
                          (void *) pID_val,
                          (sword) sizeof(ub4),
                          (ub2) SQLT_INT,
                          (void *) pID_ind,
                          (ub2 *) 0,
                          (ub2 *) 0,
                          (ub4) OCI_DEFAULT);
      ** define the second column in the results
      rc = OCIDefineByPos(stmtp,
                          &defnp,
                          pDBCtx->errhp,
                          (ub4) 2,
                          (void *) &pTSD[0],
                          (sword) sizeof(OCIDateTime *),
                          (ub2) SQLT_TIMESTAMP,
                          (void *) pTS_ind,
                          (ub2 *) 0,
                          (ub2 *) 0,
                          (ub4) OCI_DEFAULT);
      ** execute the statement
      rc = OCIStmtExecute(pDBCtx->svchp,
                          stmtp,
                          pDBCtx->errhp,
                          (ub4) arrsize,
                          (ub4) 0,
                          (CONST OCISnapshot *) NULL,
                          (OCISnapshot *) NULL,
                          (ub4) OCI_DEFAULT);
      ** get the text value of the timestamp
      ** null-terminate it, and display the value.
      ** the address of the allocated descriptor
      ** is copied from the dynamically allocated
      ** memory to the temp variable and that
      ** is passed to OCIDateTimeToText
      for (i = 0; i < arrsize; i++)
        memcpy((void *) &pTemp, &pTSD[i * sizeof(OCIDateTime *)], sizeof(OCIDateTime *));
        rc = OCIDateTimeToText((void *) pDBCtx->usrhp,
                               pDBCtx->errhp,
                               pTemp,
                               (oratext *) 0,
                               (ub1) 0,
                               (ub1) 3,
                               (oratext *) 0,
                               (size_t) 0,
                               &buflen,
                               buf);
        buf[buflen] = '\0';
        printf("Timestamp value[%d]: %s\n", *pID_val++, buf);
    ...Obviously there's lots left out, but hopefully that can be of some help. I've not really thoroughly reviewed the code so there may be a few things to fix. Anyway, using the above table and data the full sample outputs this on my system:
    Timestamp value[1]: 01-JAN-09 08.00.00.123 AM
    Timestamp value[2]: 01-JAN-09 12.34.56.789 PM
    Timestamp value[3]: 01-JAN-09 04.46.00.046 PM
    Timestamp value[4]: 01-JAN-09 10.00.00.314 PM
    ENTER to continue...Thanks,
    Mark

Maybe you are looking for

  • Cross Plant Planning- MRP activation indicator turned after the creation of Material code

    Dear Experts, Working on Cross plant planning, where 1001 Production plant will stock transfer material to 8 different plants. Right now, only 10001 plant had MRP and planning file entry ticked in customizing OMDU. The other 8 plants have Materials c

  • How to find summation inside a loop?

    Hi Experts, Please refer following code: for (int i=0 ; i<wdContext.nodeWorklist().size() ; i++){   wdContext.nodeWorklist().setLeadSelection(i);   categoryElement = wdContext.createCategoriesElement();   category_1Element = wdContext.createCategorie

  • Form_URN doesn't work for the first few times on android, and doesn't work completely on iphone.

    Dear All, I used approval workflow in my workflow and modified the content in the email sent by system to users. I used hyperlink to setup a clickable letter to Current Task : Form_URN.  (everything under workflow 2010 and SP 2013 online ) After that

  • What is error code - 36 and how to fix it?

    i am backing up my mac when i encounter this error during my iphoto transfer. May i know what is this error? apparently i am facing lots of lag and so i am in the process of reinstalling the whole system

  • Handling Events in FXML-includes

    Hi! I am using FXML to define the GUI of my application. As the GUI is pretty complex with many regions and items in it, I have created a separate FXML file for each main region to reduce the overall complexity of maintaining the design. My parent FX