Is there a sql function taking first 10 letters, even if it is less than 10

Hi all

substr (tx. DealID, 0, 10) takes the substring from 0 to 10, but the ID which are less than the length 10 to ex: 346789.In this case the substr (tx. DealID, 0, 10) returns nothing, so that DealID is not getting updated with the values in the TransactionRecord table.

So is there any function oracle I want to take the first 10 letters, although it is less than 10 to have my table of transaction ID which is also less than 10 letters.


Thank you
Jesu

First, SUBSTR is 1-based, not on 0, so the first 10 characters is SUBSTR (tx. DealID, 1, 10).
Second, what makes you think that nothing is returned if the string is less than 10 characters?

Wrote file afiedt.buf

  1* select substr( '123456789012345',1,10 ) from dual
SQL> /

SUBSTR('12
----------
1234567890

SQL> ed
Wrote file afiedt.buf

  1* select substr( '12345',1,10 ) from dual
SQL> /

SUBST
-----
12345

Justin

Tags: Database

Similar Questions

  • first instance seems to have expired after less than 24 hours

    Hi, I installed the creative trial cloud yesterday and everything was good... then I saw option to updat on all programs... since by clicking on the button update, it has updated and said it is up to date... but now I can't open it because it is not a clickable link to open the program... I thought it was a test of 30?

    Yes, it's a trial of 30 days, but your edits broken things. the bad news is that he probably ruined your trial entirely, but feel free to run the Creative Suite cleanup tool and leave the AAM to install again.

    Mylenium

  • SQL function for comparing 2 strings

    Hi all
    Is there a SQL function for comparing 2 strings?

    There is no function of pre defined in Sql for the string comparison. You can create according to your requirement.

    Concerning

  • Chain replication using a sql function...

    Hello
    Is there a sql function that reproduces a string given so many times that appears in a parameter...?
    For example: String-> test

    Select < sql_function > ('test', 3) double

    -> testtesttest

    Note: I use Oracle10g v.2

    Thank you
    SIM

    What about a SQL?

    satyaki>
    satyaki>select * from v$version;
    
    BANNER
    ----------------------------------------------------------------
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    
    Elapsed: 00:00:00.08
    satyaki>
    satyaki>
    satyaki>select DBMS_XMLGEN.getxmltype ('SELECT '||chr(39)||'&str'||chr(39)||' cola FROM dual connect
     by rownum<='||&num).EXTRACT('//text()') res
      2  from dual;
    Enter value for str: satyaki
    Enter value for num: 1
    old   1: select DBMS_XMLGEN.getxmltype ('SELECT '||chr(39)||'&str'||chr(39)||' cola FROM dual connec
    new   1: select DBMS_XMLGEN.getxmltype ('SELECT '||chr(39)||'satyaki'||chr(39)||' cola FROM dual con
    
    RES
    ----------------------------------------------------------------------------------------------------
    satyaki
    
    Elapsed: 00:00:00.07
    satyaki>/
    Enter value for str: satyaki
    Enter value for num: 2
    old   1: select DBMS_XMLGEN.getxmltype ('SELECT '||chr(39)||'&str'||chr(39)||' cola FROM dual connec
    new   1: select DBMS_XMLGEN.getxmltype ('SELECT '||chr(39)||'satyaki'||chr(39)||' cola FROM dual con
    
    RES
    ----------------------------------------------------------------------------------------------------
    satyakisatyaki
    
    Elapsed: 00:00:00.03
    satyaki>
    satyaki>/
    Enter value for str: satyaki
    Enter value for num: 3
    old   1: select DBMS_XMLGEN.getxmltype ('SELECT '||chr(39)||'&str'||chr(39)||' cola FROM dual connec
    new   1: select DBMS_XMLGEN.getxmltype ('SELECT '||chr(39)||'satyaki'||chr(39)||' cola FROM dual con
    
    RES
    ----------------------------------------------------------------------------------------------------
    satyakisatyakisatyaki
    
    Elapsed: 00:00:00.02
    satyaki>
    satyaki>/
    Enter value for str: satyaki
    Enter value for num: 5
    old   1: select DBMS_XMLGEN.getxmltype ('SELECT '||chr(39)||'&str'||chr(39)||' cola FROM dual connec
    new   1: select DBMS_XMLGEN.getxmltype ('SELECT '||chr(39)||'satyaki'||chr(39)||' cola FROM dual con
    
    RES
    ----------------------------------------------------------------------------------------------------
    satyakisatyakisatyakisatyakisatyaki
    
    Elapsed: 00:00:00.14
    

    Kind regards.

    LOULOU

    Published by: Satyaki_De on September 27, 2008 14:10

  • PL/SQL functions as LOV to use in another display object

    Hello

    We had a custom search to extract data from a display object and the data displayed as a Table of ADF. Now, there are few requests for searches on this report. Go see criteria and Panel request if we allow saved search. But the fields used in the research are going through a lot of logic and thus the PL/SQL functions are implemented. We used to call these functions and lists separated by commas and then divided the list into individual elements and put in the component "select options".

    The value (String) returned by the pl/sql function is something like - APAC, EMEA, NORTH AMERICA, FDA

    I am creating a LOV based on SQL-query "Select getRegions() from dual;

    Now, I want the list separated by commas to divide so that I could use this LOV in an another view and try the display criteria and saved searches.

    I tried to assign as LOV just to check and the criteria drop-down view for region displays same value as single element - "APAC, EMEA, NORTH AMERICA, LAD."

    I want it to be 4 separate - elements

    APAC

    EMEA

    NORTH AMERICA

    DVL

    Is there anyway to achieve this?

    Or better is at - it another way to do this (maybe I'm wrong)

    Thank you.

    JDev: 11.1.2.4

    Instead of a programmatic VO of PL/SQL, I found sometimes easier to write PL/SQL functions that return a table - need to CREATE a TYPE for the data items to be returned and a TYPE of TABLE IMBRIQUE tabular form of the first kind.  The function returns the type of table, and can even be a PIPElined table function.  Then I create a VO with the following text:

    SELECT * from TABLE (my_function_returning_table)

    The function can even take parameters, which you fill with variable BIND your VO.

  • ORA-06503: PL/SQL: function returned no value ORA-06512:

    Hi all

    SQL > set serveroutput on

    SQL > CREATE OR replace FUNCTION qty_value (p_item_id number)

    2 RETURN NUMBER

    3 EAST

    4 v_qty_arrival NUMBER;

    5 BEGIN

    6. SELECT THE CASE SENSITIVE OPTION

    7. WHAT (SUM (b.quantity) - SUM (b.quantity_received)) < = 0 THEN 0

    8 ELSE (SUM (b.quantity) - SUM (b.quantity_received))

    9 END Qty_Arrival

    10 INTO v_qty_arrival

    Po_lines_all 11 a,

    po_line_locations_all 12 b

    13 WHERE a.po_line_id = b.po_line_id

    14 AND a.item_id = p_item_id;

    15 EXCEPTION

    16 THEN THAN OTHERS THEN

    17 v_qty_arrival: = NULL;

    18 RETURN v_qty_arrival;

    19 END qty_value;

    20.

    The function is created.

    SQL >

    SQL > select xxc_qty_arrivale (214960) double

    2.

    Select xxc_qty_arrivale (214960) double

    *

    ERROR on line 1:

    ORA-06503: PL/SQL: function returned no value

    ORA-06512: at the 'APPS '. XXC_QTY_ARRIVALE', line 19

    Back AFTER using the exception block is fine as long as your code actually REACHED the exception block.

    When there are no errors, then your code will not enter the exception block, but you still NEED to return a value, since it is what functions a function wants to return a value, that's what the functions are made for.

    Spot the differences between the following 3 functions. Understand how they work.

    The first function has only a return in the exception block but runs correctly. Result: error, because the back is missing in the code block.

    The second function has a return in the exception block and one in the block of code and runs correctly. Result: no error, because the return is not missing in the code block.

    The third function has a return in the exception block and one in the block of code and is forced into an error. Result: no error, because the return of the exception handler is used (instead of retriggering of the error, which you would normally do).

    SQL > create or replace function myfunc

    2 return number

    3 as

    4 start

    5 dbms_output.put_line ('in the section of code');

    6 null;

    7 exception

    8 then than others

    9. can

    10 dbms_output.put_line (' in the exception handler ' |) SQLERRM);

    11      --

    12 return 0;

    13      --

    14 end;

    15.

    The function is created.

    SQL > select double myfunc;

    Select double myfunc

    *

    ERROR on line 1:

    ORA-06503: PL/SQL: function returned no value

    ORA-06512: at "GHPLUS. MYFUNC", line 14

    In the section of code

    SQL > create or replace function myfunc

    2 return number

    3 as

    4 start

    5 dbms_output.put_line ('in the section of code');

    6 null;

    7    --

    8 return 1;

    9    --

    10 exceptional

    11 so that others

    12. can

    13 dbms_output.put_line (' in the exception handler ' |) SQLERRM);

    14      --

    15 return 0;

    16      --

    end 17;

    18.

    The function is created.

    SQL > select double myfunc;

    MYFUNC

    ----------

    1

    1 selected line.

    In the section of code

    SQL > create or replace function myfunc

    2 return number

    3 as

    n number 4;

    5. start

    6 dbms_output.put_line ('in the section of code');

    7 n: = 1/0; -force an error (zero divisor) to join the exception handler

    8    --

    9 return 1;

    10-

    exception 11

    12 so that others

    13. can

    14 dbms_output.put_line (' in the exception handler ' |) SQLERRM);

    15      --

    16 return 0;

    17      --

    18 end;

    19.

    The function is created.

    SQL > select double myfunc;

    MYFUNC

    ----------

    0

    1 selected line.

    In the section of code

    In the handler for exception ORA-01476: divisor is equal to zero

    SQL >

  • PL/SQL function to calculate the non-working days

    Hello

    I have the following pl/sql function which generates a number of days between two selected dates (i.e. excluding weekends). However, I also need to exclude specific holidays - day of Christmas etc. These holiday dates are stored in a table in our database (11 GR 2) called "HOLIDAY".

    How can I integrate the holidays which is held in the table of holidays in the following query to exclude these dates as well? I know how to write a separate funtion pl/sql for a number of days between two dates using SELECT... BUT I can't work out how to bring together them in a single query.

    Could someone show me how with the pl/sql / dates below please?

    Example of HOLIDAY table below.

    Thank you!

    TP

    create or replace
    function WORKING_DAYS (pi_start_date in date, pi_end_date in date) return integer
    
    is
    
    v_start_date date :=pi_start_date;
    v_end_date date:=pi_end_date;
    v_count integer:=0;
    
    begin
    
    while v_start_date <= v_end_date
          loop
                            if to_char(v_start_date,'D') not in ('6','7')                    
                            then
                            v_count := v_count+1;                       
                            end if;
                           
                    v_start_date:=v_start_date+1;
                   
          end loop;
         
    return v_count;
    
    end;
    
    

    (select '10-Apr-2013' as NWD from dual union all
    select '06-May-2013' from dual union all
    select '27-May-2013' from dual union all
    select '26-Aug-2013' from dual union all
    select '26-Dec-2013' from dual union all
    select '25-Dec-2013' from dual union all
    select '01-Jan-2014' from dual union all
    select '18-Apr-2014' from dual union all
    select '21-Apr-2014' from dual union all
    select '05-May-2014' from dual union all
    select '26-May-2014' from dual union all
    select '25-Aug-2014' from dual union all
    select '25-Dec-2014' from dual union all
    select '26-Dec-2014' from dual) HOLIDAYS
    

    Hello

    the link is on MOSC, not OTN... Here's a copy:

    This function calculates the number of days between two dates, ignoring weekends and holidays (if requested and if the holidays are stored in a table)

    I give an example of table 'public_holiday' with sample data, but users must ensure that their table contains the relevant data (all holidays within the maximum range of use of the service)

    CREATE TABLE public_holiday (calendar_day, DATE, text VARCHAR2 (30));

    FUNCTION to CREATE or REPLACE nb_days (p_date_from IN DATE

    p_date_to DATE by DEFAULT TRUNC (sysdate)

    , p_public_holidays in CHAR DEFAULT 'Y '.

    ) RETURN NUMBER

    DEFINE AUTHID

    AS

    /*********************************************************************/

    / * Author: Bruno Vroman * /.

    / * Created: 23-AUG-2012 * /.

    / * Last updated: 23-AUG-2012 * /.

    / * Object: to calculate the number of days between 2 dates, to the exclusion of * /.

    / * Saturday and Sunday, but also "holidays" If the * /.

    / * argument 'p_public_holidays' = 'Y ' * /.

    / * Support: p_date_from<= p_date_to                             ="">

    / * component ' hour min dry "ignored (just counting days) * /.

    /* First step:                                                       */

    / * the calendar days between 2 days * /.

    / Remove 2 days for each "week" and 0 or 1 extra day * /.

    / * function to a condition "complex" mix day of first week * /.

    / * and the number of days when full remaining weeks are removed * /.

    / * (set up once for all, for example if there is 3 days and the * /)

    (/ * first day is a Thursday, there is 1 "Sat/Sun" to subtract) * /.

    / * Second step: If 'p_public_holidays' = 'Y': other * /.

    / * days, do not count holidays.                         */

    / Holiday everyday are defined in a table "public_holiday" * /.

    / * Note: there may be holidays defined on Saturday/Sunday.       */

    /*********************************************************************/

    l_result NUMBER;

    l_from DATE;

    l_to DATE;

    l_case tank (4);

    BEGIN

    l_from: = TRUNC (p_date_from);

    l_to: = TRUNC (p_date_to);

    l_case: = TO_CHAR (l_from, 'Dy', 'NLS_DATE_LANGUAGE = English').

    To_char (MOD (l_to - l_from + 1, 7));

    l_result: = l_to - l_from + 1

    -TRUNC ((l_to-l_from + 1) / 7) * 2

    -CASE

    WHEN l_case IN ('Mon6', 'Tue5', 'Wed4', 'Thu3', 'Fri2'

    , "Sat1", "Sun1", "Sun2', 'Sun3", "Sun4".

    , "Sun5', 'Sun6.

    )

    THEN 1

    WHEN l_case IN ('Tue6', 'Wed5', 'Wed6', 'Thu4', "Thu5"

    , 'Thu6', 'Fri3', 'Fri4', 'Fri5', 'Fri6 '.

    , "Sat2", "Sat3', 'Sat4', 'Sat5", "Sat6.

    )

    THEN 2

    0 OTHERWISE

    END

    ;

    IF SUPERIOR (p_public_holidays) = "Y".

    THEN

    SELECT l_result - COUNT (*)

    IN l_result

    OF public_holiday p

    WHERE p.calendar_day > = l_from

    AND p.calendar_day<=>

    AND SUBSTR (TO_CHAR (p.calendar_day

    , "Dy".

    'NLS_DATE_LANGUAGE = English'

    )

    , 1, 1 ) != 'S'

    ;

    END IF;

    RETURN l_result;

    EXCEPTION

    WHILE OTHERS

    THEN

    DBMS_OUTPUT. Put_line (' CTF nb_days (' |))

    To_char (p_date_from, "MON-DD-YYYY"). ', ' ||

    To_char (p_date_to, "MON-DD-YYYY"). ', ' ||

    p_public_holidays | ' ) : ' || SQLERRM

    );

    LIFT;

    END nb_days;

    /

    REM

    REM example:

    REM A) fill out the 'public_holidays '.

    REM

    TRUNCATE TABLE public_holiday;

    INSERT INTO public_holiday VALUES (DATE ' 2012-01-01', ' new year (a Sunday)');

    INSERT INTO public_holiday VALUES (DATE '' 2012-01-03, "for example");

    REM (insert other days...)

    COMMIT;

    Call the function for some pairs of dates of REM B)

    REM nb1: remove only Sat/Sun

    REM nb2: also remove holidays

    REM

    ALTER SESSION SET nls_date_format ='Dy DD-MON-YY';

    WITH some_dates AS

    (SELECT DATE ' 2011-12-29'd dual FROM

    UNION ALL SELECT DATE ' 2012-01-08' FROM dual

    UNION ALL SELECT DATE ' 2012-01-10' FROM dual

    )

    SELECT d1.d 'FROM '.

    , d2.d ' to THE '.

    , nb_days (d1.d, d2.d, ' don't) nb1

    , nb_days (d1.d, d2.d, 'Y') nb2

    OF some_dates d1

    some_dates d2

    WHERE d1.d<=>

    ORDER BY nb1, nb2, d1.d

    ;

    GO TO NB1 NB2

    ------------- ------------- ---- ----

    Monday, January 8, 12 Monday, January 8, 12 0 0

    Friday, December 29, 11 Friday, December 29, 11 1 1

    Wednesday, January 10, 12 Wednesday, January 10, 12 1 1

    Monday, January 8, 12 Wednesday, January 10, 12 2 2

    Friday, December 29, 11 Monday, January 8, 12 7 6

    Friday, December 29, 11 Wednesday, January 10, 12 9 8

    Hope that this could be useful, but note that this code has not been completely tested, so check and test before you trust it (in the case of any questions, please post a comment)

    Bruno Vroman.

    Best regards

    Bruno

  • Pass a list of values to a pl/sql function

    I would like to pass a list of values to a pl/sql function where the list will be used in an IN clause. Ideally, I would like to do the following:

    CREATE or REPLACE FUNCTION (dept_list in varchar2)
    Start
    Select... where dept in (dept_list);

    use: process_list ('7730,7735,7740,7745');

    I can't find an example to do based on pl/sql, but it seems feasible.
    Is there a way to do this?

    user12088323 wrote:

    I would like to pass a list of values to a pl/sql function where the list will be used in an IN clause.

    use: process_list ('7730,7735,7740,7745');

    The first thing is that you need an appropriate data type for storing a list of numbers. A unique value that look you like a list of numbers, is not actually a list of numbers but a single character value.

    This example uses the built in odcinumberlist data type in a procedure, you can do the same in function

    Re: Pass an array to an Oracle stored procedure

    If you have an older version of the database, you may need to create your own type with the same definition of odcinumberlist.

  • Help SQL function

    Hi all

    I have a table which includes

    ID, first_name, last name and date of birth

    I want to retrieve all the records that have the same name and DOB

    for example.

    ID, first_name, last name, DOB

    1 xyz abc 01/01/2012

    hij 2 efg 15/05/2012

    3 xyz abc 01/01/2012

    4 xyz abc 01/01/2012

    so in the output of 1, 3 and 4 rows will appear only.

    can someone advise please on the appropriate SQL function

    Thanks in advance

    Hello

    One way is to use the analytical COUNT function:

    WITH got_num_rows AS

    (

    SELECT id, first_name, last_name, dob

    , COUNT (*) OVER (PARTITION BY first name

    last_name

    ,             dob

    ) AS num_rows

    FROM table_x

    )

    SELECT id, first_name, last_name, dob

    OF got_num_rows

    WHERE num_rows > 1

    ;

    The subquery is needed here, because the analytical functions are calculated after the WHERE clause has been applied.  To use the results of an anlytic function in a WHERE clause, you must calculate the function in a subquery, then you can use the results where you want (including the WHERE clause) of a Super query.

  • XQuery SQL function

    Hello

    In a query XQuery is posssible to call a function or procedure SQL (PL / SQL)?
    Here is an example of what I had accomplished:


    SELECT THE PRD. XMLCOLUMN of
    XMLTABLE (' for $i in ora: view("P_iXXX")/LINE)
    $j in ora: view("P_jXXX")/LINE.
    where
    ($i / NSU_xxx = $j/NSU_xxx)
    return
    (
    < NCL >
    {
    $i / NSU_xxx,
    H3. CALL the SQL function? as sql_xxx
    for $k in ora: view("P_kxxx")/ROW
    ($vk/COD_RMP_VPM = "PRD")
    Return()
    }
    < / NCL >
    () "PATH of XMLType 'XMLCOLUMN' COLUMNS 'resultsqlfunction' INTEGER PATH 'xsql_xxx' INTEGER ACCESS to 'NSU_xxx' path 'NSU_xxx', '.') as the PRD;

    Thanks in advance for your answers
    François

    Who today replaces "ora: see?

    On 11.2, ora expansion feature: view() is deprecated in favor of the fn:collection("oradb:/") method:

    http://docs.Oracle.com/CD/E11882_01/AppDev.112/e23094/xdb_xquery.htm#BABECFFD

    My DBA database have installed Oracle XML DB to use the XMLType and XMLTable, I thought that these features among other things speed up the creation of XML.

    What are the benefits of using XQuery and XMLTable and XMLQUERY functions?

    Which version of the database you use?

    Please read: http://docs.oracle.com/cd/E11882_01/appdev.112/e23094/xdb_xquery.htm#CBAGCBGJ

    Is there another method to expedite the creation of XML?

    Publication of SQL/XML functions are probably the best way to create custom relational data XML documents.

    The basic functionality of XQuery is not to the RDBMS query tables or views, although Oracle provides extensions to do.
    Most of the time, I use XQuery (via XMLTable and XMLQuery) to do exactly the opposite, i.e. to extract XML data in a relational form, or the transformation of XML fragments.

    If your actual requests are slow - even if you need to define what that means and that you are pregnant - then maybe the SQL/XML functions are not the real problem.

    In a "Where clause" as I turn, I have several "outer join". Here is an example.

    where
    PPM. NSU_PPM = w.NSU_PPM and FRNS. NSU_FRN (+) IS FCO. NSU_FRN and FCO. NSU_FCO (+) IS PPM. NSU_FCO
    and T2O. NSQ_T2O (+) IS PPM. NSQ_T2O
    and T51. NSQ_T51 (+) IS PPM. NSQ_T51
    and TWU. NSU_STT (+) IS PPM. NSU_STT
    and T01. NSQ_T01 (+) IS PPM. NSQ_T01
    and vpm.cod_rmp_vpm (+) = "PRA".
    and vpm.num_vsn_vpm (+) = PPM.vsn_sup
    and w.nsu_ppm = A.nsu_ppm (+)
    and W.NSU_SOO = A_HEADER. NSU_SOO and A_HEADER. NOR_SOM = 0

    Yes, it's exactly what I was talking about.
    Transposing the logic for XQuery 1.0 is not the approach more simple (to say the least), because there is no direct support OUTER JOIN.
    XQuery 3.0 provides the functionality, but it is not yet here in the database.

    My suggestion would be to stick to the publication of SQL/XML functions.
    If you have a specific question about the performance, we (as the members of the forum) will be happy to help you.
    Provides the steps necessary to reproduce the problem, including some examples of data.

    Kind regards

    Marc.

  • No support for oracle sql functions

    Hi all

    Please can someone explain why the B-tree indexes are not capable of supporting SQL queries using the built-in functions of Oracle.

    We have indexes of tree b on account_no column.

    Select * from test_table where account_no = 11005208

    the above query use the index on account_no

    Select * from test_table where superior (account_no) = 11005208

    But this query does not use the index on the account_no, going for the full table scan.

    My question here is account_no is the numeric data type.
    Then, there is no difference between the data in the columns account_no and upper (account_no) column data, so why he does not use index when using sql functions in an sql query?

    Hello

    If you apply the upper function, Oracle implicitly converts its argument to a string, so your query is actually upper (to_char (account_no)).
    There is none HAVE fully functional in the optimizer and you do not expect to know everything and do all the conclusions that a human being can do. Why should Oracle re - write this type of query analysis the data type of the columns and features when it seems more natural programmer write a correct query (without capital letters in this example) or, if necessary, create an index based on a function?

  • Problem inserting new line in a VO with SQL functions and subqueries

    Hello

    I use JDeveloper 10.1.3.4 and and stuck with insertion of a new line when the values to insert into some fields of the new line are returns of SQL functions and subqueries.

    At the sqlplus prompt, the following sql statement is tested and developed successfully:
    insert into VALIDATIONS values (
       '111223333', 'JANE', 'DOE',
       SYSDATE,
       (select to_char(sysdate, 'yymmdd') from dual)||
       (select to_char(count(TRANSACTION_DATE)+1,'fm0999') from VALIDATIONS
          where trunc(TRANSACTION_DATE) = to_char(sysdate))
    );
    Note that the values for the fields of 4th and 5th are returns of subqueries and SQL functions.

    Ideally, it would be simple to assemble a SQL and executed him as he did to the old way of servlet:
    String sql = "insert into VALIDATIONS values ('" + id + "', '" + firstName + "', '" + lastName + "', SYSDATE, (select to_char( ......)))";
    statement.executeUpdate(sql);
    I'm not sure it can be done in JDeveloper, and it was not found in the developer's guide. What I found was rather:
    // 1. Find the ServiceRequests view object instance.
    ViewObject svcReqs = am.findViewObject("ServiceRequests");
    // 2. Create a new row and insert it into the row set
    Row newSvcReq = svcReqs.createRow();
    svcReqs.insertRow(newSvcReq);
    // 3. Show effect of entity object defaulting for Status attribute
    System.out.println("Status defaults to: "+newSvcReq.getAttribute("Status"));
    // 4. Set values for some of the required attributes
    newSvcReq.setAttribute("CreatedBy",308); // Nancy Greenberg (user)
    Date now = new Date(new Timestamp(System.currentTimeMillis()));
    newSvcReq.setAttribute("RequestDate",now);
    newSvcReq.setAttribute("ProdId",119); // Ice Maker
    newSvcReq.setAttribute("ProblemDescription","Cubes melt immediately");
    // 5. Commit the transaction
    am.getTransaction().commit();
    In my case, it would be OK for the first three fields as shown below (in the code of transactionsRecords is a display object). But what about the 4th and 5th fields?
    Row newTransaction = transactionsRecords.createRow();
    transactionsRecords.insertRow(newTransaction);
    newTransaction.setAttribute("StudentId", id);
    newTransaction.setAttribute("FirstName", firstName);
    newTransaction.setAttribute("LastName", lastName);
    
    newTransaction.setAttribute("TransactionDate", <how to put "SYSDATE" here?>);
    newTransaction.setAttribute("ConfirmNumber", <how to put subqueries here?>);
    A big thank you to those who know or have experience before!


    Newman

    Newman,
    You can do this via a procedure call. This technique is described here
    I guess you can't do this directly in the EO or VO.
    You can do it the old way to create a prepared directly query and call it as you described. To get the declaration use getDBTransaction () .createPreparedStatement (...) method available in the module of your application.
    Be aware of the implications using the given solution. The framework doesn't know anything of what you are doing. So to see the changes that you used to update the tables that you change.

    Timo

  • Customize a page based on the SQL function

    Hello

    Please someone help me solve this problem.

    In a page I am Image. By clicking on the image, a page will open. The image is created using the code of the controller.

    The values are displayed in the second page based on the clicked image.

    While the page is being prepared a SQL function must obtain an entry and based on the input TextField should be changed to read-only or not.

    Thanks in advance,
    Roselyne

    There is no log file for OFA...

    Set the profile FND: Diagnostics to 'yes '.

    You can see the error on the screen.

    Prasanna-

  • Connect the two spreadsheets through a pl/sql function registered

    Hello
    Need help to connect the two worksheets using a stored function.

    Step 1:
    Created a function * (test_global) Pl/SQL * in which a table * (TWG) global * is inserted with lines based on criteria (via a call to a pl/sql procedure packed).
    The function returns the number of rows in the global table or 0 if no row is returned.
    The TWG was created using "On Commit preserve rows.

    Step 2:
    The function test_global has been saved to the Finder via the "PL/SQL functions to register.

    Step 3:
    Create a spreadsheet calculation - & gt; Sheet1 and included a Calculation (calc_global) that calls the test_global function.

    Step 4:
    Add another sheet of calculation - & gt; Sheet2 based on a query to select lines in the TWG where calc_global & gt; 0

    Step 5:
    Refreshed Sheet1 - & gt; displays the number of rows as * 5119 *.
    Refreshed Sheet2 - & gt; takes some time to run but returns no data

    Tried to:
    ) a calc_global link on Sheet1 with the help of sheet 2 links management, this does not work either
    (b) changed using the Pragma autonomous transaction function; gives an error that says no data returned by 1 sheet Sheet2.

    Please help with a solution, it seems that there are data in the TWG at the time Sheet1 is running need to display data in the sheet2 worksheet.

    Thanks in advance
    SP

    Hello

    You need to call test_global function once on Sheet1 that fit lines within the TWG. In Sheet2, you simply select the TWG and do not have the conditions of anywhere in this form. Try to run Sheet2 without calc_global > 0.

    Rod West

  • Filling point with the body of the pl/sql function

    Hello

    I want to fill an item "Show as text (saves the State)" in contrast to the other 2 points.

    The source of my question is:
    -Only when the current...
    -Body of PL/SQL function
    -Term source:
    DECLARE
    v_diff NUMBER;
    BEGIN
    v_diff: =: P1_AUFWAND_TOTAL -: P1_AUFWAND_BERECHNET;
    Return v_diff;
    END;

    Now I get this error:

    ORA-06502: PL/SQL: taking oder Wertefehler: Fehler beim zu if indication Zahl von
    Error ERR-1904 unable to calculate the default item: type = body of the function...

    I tried to find the problem with the conversion to_number:
    v_diff: = to_number(':P1_AUFWAND_BERECHNET'); or
    v_diff: = to_number (': P1_AUFWAND_BERECHNET', '999G999D00');

    What's not here? It's as if I'm making a simple mistake...

    Thanks for any help,
    Roger

    If the following code does not work for you, then one of the two elements are not the numbers:

    DECLARE
       v_diff   NUMBER;
    BEGIN
       v_diff := TO_NUMBER (:p1_aufwand_total)
                 - TO_NUMBER (:p1_aufwand_berechnet);
       RETURN v_diff;
    EXCEPTION
       WHEN OTHERS
       THEN
          RETURN SQLERRM;
    END;
    

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    -------------------------------------------------------------------

Maybe you are looking for

  • Cloning of mbp ssd

    Hi guys, I just need to know is it cloning software that allows you to clone your hard drive to another ssd or hdd or ssd which includes the recovery ios and partation any window you created via bootcamp. I know that carbon copy allows you to clone t

  • Unable to receive mail after installation of El Capitan

    I run a Mac Pro 2012 model and since the passage of Lion in El Capitan, I am unable to receive emails. I can send emails OK. I checked all the preferences of mail several times and they are correct. Internet connection is fine and everything else see

  • Unable to connect to my router wireless - Satellite A200

    Hello Can someone help me to connect my laptop to my wireless router? He used to work, but note accept the security code that my other pc is running without problems. The laptop connects to other unsecured sites and is ok hard wired to the router. I

  • LAN at impact software GPIB controller

    I wrote a Labview program on a PC with a GPIB controller to copy card to control an electronic load GPIB using NI VISA and provided seller Labview VIs that use NI-VISA.  I now have to implement the same program on a laptop using a LAN to the GPIB con

  • 0x8007065D data supplied is of wrong type

    This is an ongoing problem! I can't make backup/restore(last backup August 2009) Keep getting 'backup failed... ". Data provided is wrong type (0x8007065D), I have tried all the suggested fix (sfc/scannow, performed a clean boot, etc), but nothing he