sqlplsqloracle-ebs

how to print record type attributes of a variable using FND_FILE.PUT_LINE - Oracle


A PLSQL program uses a variable named x_api_errors, which is a record type defined as: enter image description here

I want to print x_api_errors.message_name and x_api_errors.message_text to Oracle EBS job log using FND_FILE.PUT_LINE.

I expected this could easliy be done using (according to documentation this should work):

FND_FILE.PUT_LINE(FND_FILE.LOG,v_api_errors.message_name);

..but it is giving:

[Error] PLS-00306 (343: 21): 
PLS-00306: wrong number or types of arguments in call to 'PUT_LINE'

How can I make this work? It seems to be a problem related to type conversion because when I try to do:

v_errorMessage:=v_api_errors.message_name;

It gives error:

[Error] PLS-00382 (344: 50): 
PLS-00382: expression is of wrong type

..but I am not able to TO_CHAR or CAST v_api_errors.message_name to VARCHAR2.


Solution

  • As per the article at https://itz4oracleapps.blogspot.com/2012/03/update-po-line-price-oracle-apps.html

    In there example they delcare

     l_api_errors po_api_errors_rec_type;
    

    Then when they access it they access it they use a loop as below

    FOR i IN 1 .. l_api_errors.message_text.COUNT LOOP
      put_log (l_api_errors.message_text (i)); 
    END LOOP;
    

    This indicates that the 'Nested objects' as seen in your screenshot are arrays and will need to be accessed using the array syntax eg

    v_api_errors.message_name(1)