You should use the field_view_field() function. Have a look at the follwing page for more information:
http://coder1.com/articles/printing-or-rendering-node-field-or-profile2-field-drupal-7 

How do I reference (what is the syntax I have to use) to get the data of my Profile2 custom fields?
I need to update a table based on another table, so I have the statement:

update FAULTS
set FAULTS.FAULT_STATE = (
    select INCIDENTS.TICKET_STATE from INCIDENTS
    where INCIDENTS.CF_ID = FAULTS.CF_ID
)


And it gives me error saying: 

ORA-01427: single-row subquery returns more than one row


I tried DISTINCT but the state values are different too so DISTINCT does not work. So I changed it too:

update FAULTS
set FAULTS.FAULT_STATE = (
    select INCIDENTS.TICKET_STATE from INCIDENTS
    where INCIDENTS.CF_ID = FAULTS.CF_ID and rownum = 1
)


Now it does not give errors. 

The problem is, if the sub-query returns a null, it will also update the row and clear the content. Any fix for that?
