SQL Query to update Item OnHand in SAP B1 2005

hi all,
              is it possible to write a Update query in sql to modify item OnHand ? is it possible to do that in SAP B1 for UDF?
     i want to create a UDF and the enter value in it should be deducted from the Item OnHand Stock. is there any query is possible to modify the item on hand.
if it is possible then kindly send me the query.
sandip

hey sandip if u are updatin ur own fields then it is allowed. But if it a field in the sap tables then NO way.. U gotta use the DI API to update these fields.. I u want to reduce the stock the n use the Goods Issue DIAPI.. I tink its The INVGenEXit DiAPI.. Remember if u using the DiApI u Allowed to do only wat u can in the front end
Regards
Aris

Similar Messages

  • SQL Query to update Item OnHand in SAP B1

    hi all,
                  is it possible to write a Update query in sql to modify item OnHand ? is it possible to do that in SAP B1 for UDF?
         i want to create a UDF and the enter value in it should be deducted from the Item OnHand Stock. is there any query is possible to modify the item on hand.
    if it is possible then kindly send me the query.
    sandip

    Hi Sandip,
    Modifying the OnHand quantity for an item directly through SQL is forbidden by SAP. Updating a UDF is also not recommended. The recommended method for updating a UDF is through the SDK.
    I'm not sure what you are trying to achieve. If you wish to change the stock quantity for an item then you need to add the most appropriate transaction, either through the UI or via the SDK (eg Goods Issue, Goods Receipt, AR Delivery etc).
    Kind Regards,
    Owen

  • Not to able add sql query in the item source

    Hi,
    I am getting this error when i am trying to add the sql query in the item source
    ORA-20505: Error in DML: p_rowid=3206911131098131, p_alt_rowid=ID, p_rowid2=, p_alt_rowid2=. ORA-01461: can bind a LONG value only for insert into a LONG column
    SELECT
    "UCL"
    FROM
    SELECT
    TRUNC((
    (SUM("EV FINAL" / 100) / COUNT("Object_Name") )
    +
    3 *
    SQRT
    (SUM("EV FINAL" / 100) * SUM("EV FINAL" / 100) ) / COUNT("Object_Name") -
    (SUM("EV FINAL" / 100) / COUNT("Object_Name")) * (SUM("EV FINAL" / 100) / COUNT("Object_Name"))
    ),3) "UCL"
    FROM
    SELECT
    Pro.Project_Name "Project Name",
    POBJ.NAME "Object_Name",
    TRUNC((
    ( ( NVL(AEV."Total Actual",0) - (NVL( (NVL( (MAX(X."Incoming-Doc") / 100),0) * NVL(ID."INCOMMING_DOC",0) ) ,0 ) +
    NVL( (NVL( (MAX(X."Design") / 100),0) * NVL(D."DESIGN",0) ), 0 ) +
    NVL( (NVL( (MAX(X."Build") / 100) ,0) * NVL(B."BUILD",0) ),0 ) +
    NVL( (NVL( (MAX(X."Testing") / 100),0) * NVL(T."TESTING",0) ),0 ) +
    NVL( (NVL( (MAX(X."Release") / 100),0) * NVL(R."RELEASE",0) ),0 ) ) )
    DECODE(
    (NVL( (NVL( (MAX(X."Incoming-Doc") / 100),0) * NVL(ID."INCOMMING_DOC",0) ) ,0 ) +
    NVL( (NVL( (MAX(X."Design") / 100),0) * NVL(D."DESIGN",0) ), 0 ) +
    NVL( (NVL( (MAX(X."Build") / 100) ,0) * NVL(B."BUILD",0) ),0 ) +
    NVL( (NVL( (MAX(X."Testing") / 100),0) * NVL(T."TESTING",0) ),0 ) +
    NVL( (NVL( (MAX(X."Release") / 100),0) * NVL(R."RELEASE",0) ),0 ) ),0,NULL,
    (NVL( (NVL( (MAX(X."Incoming-Doc") / 100),0) * NVL(ID."INCOMMING_DOC",0) ) ,0 ) +
    NVL( (NVL( (MAX(X."Design") / 100),0) * NVL(D."DESIGN",0) ), 0 ) +
    NVL( (NVL( (MAX(X."Build") / 100) ,0) * NVL(B."BUILD",0) ),0 ) +
    NVL( (NVL( (MAX(X."Testing") / 100),0) * NVL(T."TESTING",0) ),0 ) +
    NVL( (NVL( (MAX(X."Release") / 100),0) * NVL(R."RELEASE",0) ),0 ) ) ) ) * 100),2)
    || '%' "EV_INITIAL",
    TRUNC((
    ( (NVL(AEV."Total Actual",0) - ( NVL( (NVL( (MAX(X."Incoming-Doc") / 100),0) * NVL(IDR."INCOMMING_DOC_REPLAN",0) ),0) +
    NVL( (NVL( (MAX(X."Design") / 100),0) * NVL(DR."DESIGN_REPLAN",0)),0) +
    NVL( (NVL( (MAX(X."Build")/100),0) * NVL(BR."BUILD_REPLAN",0)),0) +
    NVL( (NVL( (MAX(X."Testing") / 100),0) * NVL(TR."TESTING_REPLAN",0)),0) +
    NVL( (NVL( (MAX(X."Release")/100),0) * NVL(RR."RELEASE_REPLAN",0)),0) ) )
    DECODE(
    ( NVL( (NVL( (MAX(X."Incoming-Doc") / 100),0) * NVL(IDR."INCOMMING_DOC_REPLAN",0) ),0) +
    NVL( (NVL( (MAX(X."Design") / 100),0) * NVL(DR."DESIGN_REPLAN",0)),0) +
    NVL( (NVL( (MAX(X."Build")/100),0) * NVL(BR."BUILD_REPLAN",0)),0) +
    NVL( (NVL( (MAX(X."Testing") / 100),0) * NVL(TR."TESTING_REPLAN",0)),0) +
    NVL( (NVL( (MAX(X."Release")/100),0) * NVL(RR."RELEASE_REPLAN",0)),0) ) ,0,NULL,
    ( NVL( (NVL( (MAX(X."Incoming-Doc") / 100),0) * NVL(IDR."INCOMMING_DOC_REPLAN",0) ),0) +
    NVL( (NVL( (MAX(X."Design") / 100),0) * NVL(DR."DESIGN_REPLAN",0)),0) +
    NVL( (NVL( (MAX(X."Build")/100),0) * NVL(BR."BUILD_REPLAN",0)),0) +
    NVL( (NVL( (MAX(X."Testing") / 100),0) * NVL(TR."TESTING_REPLAN",0)),0) +
    NVL( (NVL( (MAX(X."Release")/100),0) * NVL(RR."RELEASE_REPLAN",0)),0) ) ) ) * 100),2) "EV FINAL",
    TRUNC(BRV."RSV",2) "Revised SV"
    FROM
    PROJECTS PRO,
    PROJECT_OBJECTS POBJ,
    INITIAL_EFFORT IE,
    SCHEDULE_VARIANCES SV,
    INITIAL_EFFORT_VIEW IEV,
    INCOMMING_DOC ID,
    DESIGN D,
    BUILD B,
    TESTING T,
    RELEASE R,
    INCOMMING_DOC_REPLAN IDR,
    DESIGN_REPLAN DR,
    BUILD_REPLAN BR,
    TESTING_REPLAN TR,
    RELEASE_REPLAN RR,
    ACTUAL_EFFORT_VIEW AEV,
    REPLAN_INITIAL_EFFORT_VIEW RIEV,
    BSV_RSV_VIEW BRV,
    SELECT
    distinct
    pro.project_name "Project Name",
    pobj.name "Object Name",
    PRO.ID "PRO_ID",
    POBJ.ID "POBJ_ID",
    CASE
    WHEN
    ts.status in ('CLOSE','CLOSED','Closed') AND
    tsk.name in ('Incomming-Doc Review','Incoming Doc- Review',
    'Incoming Doc- Review','FDD - Review') THEN
    TO_CHAR('100')
    WHEN
    upper(ts.status) like upper('ACCEPTED') AND
    tsk.name in ('Incomming-Doc Review','Incoming Doc- Review',
    'Incoming Doc- Review','FDD - Review') THEN
    TO_CHAR('75')
    WHEN
    ts.status IN ('RIP','WIP','REJECTED','Rejected') AND
    tsk.name in ('Incomming-Doc Review','Incoming Doc- Review',
    'Incoming Doc- Review','FDD - Review') THEN
    TO_CHAR('50')
    WHEN
    POBJ.ID IN (SELECT POBJ.ID FROM projects pro,project_objects pobj,task tsk,skip_phase sp,employees
    emp,employee_project_pairs epp
    WHERE pobj.pro_id = pro.id and epp.pro_id = pro.id AND sp.tas_id = tsk.id and
    pobj.id = sp.OBJ_ID and pro.id = sp.pro_id
    and tsk.name in ('Incomming-Doc Review','Incoming Doc- Review',
    'Incoming Doc- Review','FDD - Review')
    AND PRO.ID = :p2_projects ) THEN
    TO_CHAR('100')
    END "Incoming-Doc",
    CASE
    WHEN
    ts.status in ('CLOSE','CLOSED','Closed') AND
    tsk.name in ('Design Review','Design - Review','TDD - Review') THEN
    TO_CHAR('100')
    WHEN
    UPPER(ts.status) LIKE UPPER('ACCEPTED') AND
    tsk.name in ('Design Review','Design - Review','TDD - Review') THEN
    TO_CHAR('75')
    WHEN
    ts.status IN ('RIP','WIP','REJECTED','Rejected') AND
    tsk.name in ('Design Review','Design - Review','TDD - Review')
    THEN
    TO_CHAR('50')
    WHEN
    POBJ.ID IN (SELECT POBJ.ID FROM projects pro,project_objects pobj,task tsk,skip_phase sp,employees
    emp,employee_project_pairs epp
    WHERE pobj.pro_id = pro.id and epp.pro_id = pro.id AND sp.tas_id = tsk.id and
    pobj.id = sp.OBJ_ID and pro.id = sp.pro_id
    and tsk.name in ('Design Review','Design - Review','TDD - Review')
    AND PRO.ID = :p2_projects ) THEN
    TO_CHAR('100')
    END "Design",
    CASE
    WHEN
    ts.status in ('CLOSE','CLOSED','Closed') AND
    tsk.name in ('Build Review','Build - Review','Code - Review','Code') THEN
    TO_CHAR('100')
    WHEN
    UPPER(ts.status) LIKE UPPER('ACCEPTED') AND
    tsk.name in ('Build Review','Build - Review','Code - Review','Code') THEN
    TO_CHAR('75')
    WHEN
    ts.status IN ('RIP','WIP','REJECTED','Rejected') AND
    tsk.name in ('Build Review','Build - Review','Code - Review','Code') THEN
    TO_CHAR('50')
    WHEN
    POBJ.ID IN (SELECT POBJ.ID FROM projects pro,project_objects pobj,task tsk,skip_phase sp,employees
    emp,employee_project_pairs epp
    WHERE pobj.pro_id = pro.id and epp.pro_id = pro.id AND sp.tas_id = tsk.id and
    pobj.id = sp.OBJ_ID and pro.id = sp.pro_id
    and tsk.name in ('Build Review','Build - Review','Code - Review','Code')
    AND PRO.ID = :p2_projects ) THEN
    TO_CHAR('100')
    END "Build",
    CASE
    WHEN
    ts.status in ('CLOSE','CLOSED','Closed') AND
    tsk.name in ('Test Result Review','Test Result - Review','UTR - Review') THEN
    TO_CHAR('100')
    WHEN
    UPPER(ts.status) LIKE UPPER('ACCEPTED') AND
    tsk.name in ('Test Result Review','Test Result - Review','UTR - Review') THEN
    TO_CHAR('75')
    WHEN
    ts.status IN ('RIP','WIP','REJECTED','Rejected') AND
    tsk.name in ('Test Result Review','Test Result - Review','UTR - Review') THEN
    TO_CHAR('50')
    WHEN
    POBJ.ID IN (SELECT POBJ.ID FROM projects pro,project_objects pobj,task tsk,skip_phase sp,employees
    emp,employee_project_pairs epp
    WHERE pobj.pro_id = pro.id and epp.pro_id = pro.id AND sp.tas_id = tsk.id and
    pobj.id = sp.OBJ_ID and pro.id = sp.pro_id
    and tsk.name in ('Test Result Review','Test Result - Review','UTR - Review')
    AND PRO.ID = :p2_projects ) THEN
    TO_CHAR('100')
    END "Testing",
    CASE
    WHEN
    ts.status in ('CLOSE','CLOSED','Closed') AND
    tsk.name in ('Release-Review','Release - Verification',
    'Migration & Release - Review') THEN
    TO_CHAR('100')
    WHEN
    UPPER(ts.status) LIKE UPPER('ACCEPTED') AND
    tsk.name in ('Release-Review','Release - Verification',
    'Migration & Release - Review') THEN
    TO_CHAR('75')
    WHEN
    ts.status IN ('RIP','WIP','REJECTED','Rejected') AND
    tsk.name in ('Release-Review','Release - Verification','Migration & Release - Review') THEN
    TO_CHAR('50')
    WHEN
    POBJ.ID IN (SELECT POBJ.ID FROM projects pro,project_objects pobj,task tsk,skip_phase sp,employees
    emp,employee_project_pairs epp
    WHERE pobj.pro_id = pro.id and epp.pro_id = pro.id AND sp.tas_id = tsk.id and
    pobj.id = sp.OBJ_ID and pro.id = sp.pro_id
    and tsk.name in ('Release-Review','Release - Verification','Migration & Release - Review' )
    AND PRO.ID = :p2_projects ) THEN
    TO_CHAR('100')
    END "Release"
    FROM
    task_status ts,projects pro,project_objects pobj,task tsk
    ,employees emp,employee_project_pairs epp,REVIEW_ITEMS RI
    WHERE
    pobj.pro_id = pro.id
    and pro.id = ts.pro_id
    and pobj.id = ts.pro_obj_id
    and tsk.id = ts.task_id
    and emp.id = epp.emp_id
    and epp.pro_id = pro.id
    and ts.id = ri.ts_id
    AND PRO.ID = :p2_projects
    and tsk.name in ('Incomming-Doc Review','Incoming Doc- Review',
    'Incoming Doc- Review','FDD - Review','Design Review','Design - Review','TDD - Review',
    'Build Review','Build - Review','Code - Review','Code',
    'Test Result Review','Test Result - Review','UTR - Review',
    'Release-Review','Release - Verification','Migration & Release - Review')
    and ri.open_timestamp in
    SELECT
    distinct
    max(ri.open_timestamp)
    FROM
    task_status ts,projects pro,project_objects pobj,task tsk
    ,employees emp,employee_project_pairs epp,REVIEW_ITEMS RI
    WHERE
    pobj.pro_id = pro.id
    and pro.id = ts.pro_id
    and pobj.id = ts.pro_obj_id
    and tsk.id = ts.task_id
    and emp.id = epp.emp_id
    and epp.pro_id = pro.id
    and ts.id = ri.ts_id
    and tsk.name in ('Incomming-Doc Review','Incoming Doc- Review',
    'Incoming Doc- Review','FDD - Review','Design Review','Design - Review','TDD - Review',
    'Build Review','Build - Review','Code - Review','Code',
    'Test Result Review','Test Result - Review','UTR - Review',
    'Release-Review','Release - Verification','Migration & Release - Review')
    AND PRO.ID = :p2_projects
    GROUP BY POBJ.NAME,TSK.NAME )
    UNION
    select
    distinct
    pro.project_name "Project Name",
    pobj.name "Object Name",
    PRO.ID "PRO_ID",
    POBJ.ID "POBJ_ID",
    case
    when
    tsk.name in ('Incomming-Doc Review','Incoming Doc- Review',
    'Incoming Doc- Review','FDD - Review') THEN
    TO_CHAR('100')
    end "Incoming-Doc",
    case
    when
    tsk.name in ('Design Review','Design - Review','TDD - Review') THEN
    TO_CHAR('100')
    end "Design",
    case
    when
    tsk.name in ('Build Review','Build - Review','Code - Review','Code') THEN
    TO_CHAR('100')
    end "Build",
    case
    when
    tsk.name in ('Test Result Review','Test Result - Review','UTR - Review') THEN
    TO_CHAR('100')
    end "Testing",
    case
    when
    tsk.name in ('Release-Review','Release - Verification',
    'Migration & Release - Review') THEN
    TO_CHAR('100')
    end "Release"
    FROM
    projects pro
    ,project_objects pobj
    ,task tsk
    ,skip_phase sp
    ,employees emp
    ,employee_project_pairs epp
    WHERE
    pobj.pro_id = pro.id
    and epp.pro_id = pro.id
    AND sp.tas_id = tsk.id
    and pobj.id = sp.OBJ_ID
    and pro.id = sp.pro_id
    and tsk.name in ('Incomming-Doc Review','Incoming Doc- Review',
    'Incoming Doc- Review','FDD - Review','Design Review','Design - Review',
    'TDD - Review','Build Review','Build - Review','Code - Review','Code',
    'Test Result Review','Test Result - Review','UTR - Review',
    'Release-Review','Release - Verification','Migration & Release - Review')
    and pro.id = :p2_projects ) X
    WHERE
    PRO.ID = POBJ.PRO_ID AND
    PRO.ID = IE.PROJECT_NAME AND
    UPPER(POBJ.NAME) = UPPER(IE.OBJECT_NAME) AND
    PRO.ID = SV.PROJECT_NAME AND
    UPPER(POBJ.NAME) = UPPER(SV.OBJECT_NAME) AND
    PRO.ID = :p2_projects
    AND PRO.ID = X."PRO_ID"
    AND POBJ.ID = X."POBJ_ID"(+)
    AND PRO.ID = IEV."PRO_ID"
    AND POBJ.ID = IEV."POBJ_ID"
    AND PRO.ID = ID."PRO_ID"
    AND POBJ.ID = ID."POBJ_ID"
    AND PRO.ID = D."PRO_ID"
    AND POBJ.ID = D."POBJ_ID"
    AND PRO.ID = B."PRO_ID"
    AND POBJ.ID = B."POBJ_ID"
    AND PRO.ID = T."PRO_ID"
    AND POBJ.ID = T."POBJ_ID"
    AND PRO.ID = R."PRO_ID"
    AND POBJ.ID = R."POBJ_ID"
    AND PRO.ID = IDR."PRO_ID"
    AND POBJ.ID = IDR."POBJ_ID"
    AND PRO.ID = DR."PRO_ID"
    AND POBJ.ID = DR."POBJ_ID"
    AND PRO.ID = BR."PRO_ID"
    AND POBJ.ID = BR."POBJ_ID"
    AND PRO.ID = TR."PRO_ID"
    AND POBJ.ID = TR."POBJ_ID"
    AND PRO.ID = RR."PRO_ID"
    AND POBJ.ID = RR."POBJ_ID"
    AND PRO.ID = AEV."PRO_ID"
    AND POBJ.ID = AEV."POBJ_ID"
    AND PRO.ID = RIEV."PRO_ID"
    AND POBJ.ID = RIEV."POBJ_ID"
    AND PRO.ID = BRV."PRO_ID"
    AND POBJ.ID = BRV."POBJ_ID"
    group by
    PRO.PROJECT_NAME,
    POBJ.NAME,
    SV.status,
    sv.comments,
    ID."INCOMMING_DOC",D."DESIGN",B."BUILD",T."TESTING",R."RELEASE",
    IDR."INCOMMING_DOC_REPLAN",DR."DESIGN_REPLAN",BR."BUILD_REPLAN",TR."TESTING_REPLAN",RR."RELEASE_REPLAN",
    AEV."Total Actual",IEV."Total Plan",RIEV."Total Plan",
    BRV."BSV",BRV."RSV",POBJ.Complexity,POBJ.PROGRAM_TYPE,pro.id,pobj.id,BRV."Status"
    wht is the mistake i am doing here please suggets
    thanks
    Sudhir

    Can you just setup an Excel/Essbase retrieval to get the data you need? You can't use SQL to query Essbase; here is a blog post that talks about it:
    http://timtows-hyperion-blog.blogspot.com/2008/01/why-you-cant-use-sql-to-query-essbase.html
    Since I made that post, I have found out that Essbase has now been integrated into the latest version of the Oracle BI Server and, technically, you could use SQL to query the data in Essbase via the Oracle BI Server if you have the right version.
    Tim Tow
    Applied OLAP, Inc

  • Form on SQL query for updating.

    Hello again,
    Im trying to wirte a form to udapte the information in a table. I have a table with a PK which holds a persons name, and an activity assigned to them (and loads of other fields but they dont matter atm). I would like to have a form which has an SQL query running in one region and then the form underneath to be able to edit (reassign a person to a different activity) an item appearing in the query result. Ive got a form at the moment which is form on an sql query but its not updating when i fill out the form, is it something to do with the regions?
    http://img.photobucket.com/albums/v611/Funky_Monk/untitled.jpg
    So on the screenie, i have the bottom region for the query (no values in table hence the error (i think!))
    The call ID is FK to another table
    severity level and status will be usdated here
    description is self-explanitory
    analyst_id is the main field to be changed here, the call id will be assigned a new analyst via this form.
    action_id is actions carried out on this problem.
    Any help would be greatly appreciated.
    DM

    hi,
    Can you put this example on apex.oracle.com?
    Regards,
    Kartik Patel
    http://patelkartik.blogspot.com/
    http://apex.oracle.com/pls/apex/f?p=9904351712:1

  • Report- Pl/sql function returning sql query parsing page items as text?

    Hi Team,
    I am facing a strange issue .
    I have four page items namely
    1)JOB_CODE
    2)MIN_EXP
    3) MAX_EXP
    4) SOURCES1
    I have a report of the type "Pl/sql function returning sql query"
    declare
    v_sql varchar2(4000);
    begin
    if (:JOB_CODE IS NOT NULL and :MIN_EXP IS NOT NULL and :MAX_EXP IS NOT NULL and :SOURCES1 IS NOT NULL) then
    v_sql:= 'select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where V_REQUIREMENT = :JOB_CODE and v_experience_years >= :MIN_EXP and v_experience_years <= :MAX_EXP and source like ' || '''' || '%'|| ':SOURCES1' || '%' || '''';
    elsif (:JOB_CODE IS NULL and :MIN_EXP IS NOT NULL and :MAX_EXP IS NOT NULL and :SOURCES1 IS NOT NULL) then
    v_sql := 'select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where v_experience_years >= :MIN_EXP and v_experience_years <= :MAX_EXP and source like ' || '''' || '%'|| ':SOURCES1' || '%' || '''';
    elsif (:MIN_EXP IS NULL and :JOB_CODE IS NOT NULL and :MAX_EXP IS NOT NULL and :SOURCES1 IS NOT NULL) then
    v_sql := 'select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where v_experience_years <= :MAX_EXP and V_REQUIREMENT = :JOB_CODE and source like ' || '''' || '%'|| ':SOURCES1' || '%' || '''';
    elsif (:MAX_EXP is null and :JOB_CODE IS NOT NULL and :MIN_EXP IS NOT NULL and :SOURCES1 IS NOT NULL) then
    v_sql := 'select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where V_REQUIREMENT = :JOB_CODE and v_experience_years >= :MIN_EXP and source like ' || '''' || '%'|| ':SOURCES1' || '%' || '''';
    end if;
    insert into query_list values (v_sql);
    insert into debug values (:JOB_CODE , :MIN_EXP , :MAX_EXP , :SOURCES1);
    return v_sql;
    end;
    Please not that I am insertin the query into a table called Query_list and the page item values into the table called Debug thru the pl/sql function which returns teh query.
    Now I select the data from the debug tables.
    select unique(query) from query_list;
    select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where V_REQUIREMENT = :JOB_CODE and v_experience_years >= :MIN_EXP and v_experience_years <= :MAX_EXP and source like '%:SOURCES1%'
    select * from debug;
    JOBCODE     MINEX     MAXEX     SOURCE
    21     1     10     donkeyHire
    And if I run the query in sql I get some records returned
    select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where V_REQUIREMENT = 21 and v_experience_years >= 1 and v_experience_years <= and source like 'donkeyHire'
    V_CANDIDATE_ID     V_FNAME     V_CURRENT_EMPLOYER     V_EXPERIENCE_YEARS
    2     Vengu     Andale Tech     4
    But the record does not show up in the report!
    does this type of report parse page items as text?
    Why is it so?
    Waiting for an early reply.
    Thanks,
    venkat

    Venkat - You don't want to put ':SOURCES1' in quotes like that.
    Scott

  • SQL query in some item.

    I have a string item with this example value:
    "SELECT 1 FROM dual"
    Yes, this is SQL query.
    Now I want to create PDF Report (Shared Components > Report Queries...) based on this SQL. I want to use this item (exactly, value from this item).
    How can I do it? Is this possible?
    regards,
    Jarek

    Hello,
    You can’t use “dynamic” SQL query within the Report Queries technique.
    You can use, as Luis suggested, a report region based on function returning query, in order to construct your SQL query. You can read some more details in the following:
    Re: ApEx PDF printing with Advanced support.
    Re: Dynamic Column in SQL-Statement
    Hope this helps,
    Arie.

  • Sql query to update record?

    hi1
    i have 1000 rows in my table that are not unique. i have added a new column named sno.initially that contains null values. Now i want to update the table with sno contains serial no. from 1 to 1000 in a single SQL query
    please help
    Thanks
    Harinder

    hi1
    i have 1000 rows in my table that are not unique. i
    have added a new column named sno.initially that
    contains null values. Now i want to update the table
    with sno contains serial no. from 1 to 1000 in a
    single SQL query
    please help
    Thanks
    HarinderIt will work..
    Update <table_name> set <column_name> = ROWNUM
    whether the records are duplicate or not...

  • Using SQL Query for page item source does not insert populated value

    Hi All,
    Following are the attribute details of a certain page item on an edit form:
    Display As: Text Field
    Page Item Source Type: SQL Query
    Source value Expression: SELECT a from tab where id = 'ABC'
    Although the field appears populated on the screen, but the value is not inserted in the table.
    Can anyone help on this?
    Thanks in advance,
    Annie

    Annie:
    One solution is to define a pl/sql function that given a date will return the 'run-date'. Something like create or replace function get_prod_date(p_date in date) return date is
    retval date;
    begin
    select run_date into retval from tab_x where run_date=p_date;
    return retval;
    end;Change the Source Type for the page-item back to 'Database Column'
    Set Source value or expression to the 'database column name'
    Set 'Post calculation computation' to be
    get_prod_date(:pxx_date)
    Varad

  • [Solved partially] Sql query for updates compliance

    Hello
    I'm trying (with no success) to translate the "Software+Updates+-+A+Compliance%2fCompliance+1+-+Overall+compliance" report into a sql query that must run for a specific
    Software update group and for a specific Collection ID.
    The expected result should be like the report it self, I mean 3 lines with Kpi (pourcentage).
    The main query in this report is : 
    select
    CollectionID=@CollID,
    Status=sn.StateName,
    cs.NumberOfComputers,
    PComputers=convert(float, isnull(cs.NumberOfComputers, 0)*100.00) / isnull(nullif(cs.NumTotal, 0), 1),
    AuthListID=@AuthListID
    from (select CI_ID, NumTotal, [0]=NumUnknown, [1]=NumPresent+NumNotApplicable, [2]=NumMissing
    from fn_rbac_UpdateSummaryPerCollection(@UserSIDs)
    where CI_ID=@CI_ID and CollectionID=@CollID
    ) cnt
    unpivot (NumberOfComputers for [Status] in ([0], [1], [2])) cs
    left join fn_rbac_StateNames(@UserSIDs) sn on sn.TopicType=300 and sn.StateID=cs.Status
    where cs.NumberOfComputers>0
    order by cs.NumberOfComputers desc
    I have no clue on how to replace or use fr_rbac view when run outside a report.
    Can you please help me ?
    Thanks

    Hi,
    Glad to hear that and thank you for your sharing.
    Best Regards,
    Joyce
    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.

  • SQL Query to update UDF

    Hi all
    Can anyone please assist me here , on my db i have
    three UDF's linked to one table.
    These UDF's are for routes - when you select the route code the query must update the route name and the driver name .
    This info is all in one UDT.
    Thanks

    Hello Bongani,
    SELECT
       T0.U_DriverName
    FROM
       .[@Routes] T0
    WHERE
       T0.Code=$[TABLE.FIELD]
    /code
    I assume you have the Routes UDT set like this:
    Code | Name | DriverName | ...
    Just change TABLE and FIELD with the name of the table and field you're importing the value to.
    Best Regards,
    Vítor

  • SQL query that change item input

    Hi,
    I have an application with a region that displays data from a database through a dblink in which the query is dependent on a value input into a couple of items in the application.
    Here is the SQL:
    SELECT
    FROM
    rem_rp_tract@DBLINK_WPC29_G6CEFMP1.NWO.USACE.ARMY.MIL "REM_RP_TRACT"
    WHERE
    "REM_RP_TRACT"."PROJ_ID" = upper(:P2_PROJECT_CODE)
    AND "REM_RP_TRACT"."TRACT_NO" = upper(:P2_TRACTNO)
    The P2_PROJECT_CODE and P2_TRACTNO values correspond to locations in a map layer in oracle spatial and data in the dblink indicated in the SQL. The problem is that the TRACT is designated with a dash (J-840) in oracle spatial and in the database it is designated without a dash (J840). Therefore, if I input Tract Number J-840 into the item have developed the app and map to zoom to the tract but no data is displayed because the database does not recognize the value. On the other hand, if I input J840 the data from the database will displayed but oracle spatial doesn't recognize it so the map does not zoom to the tract.
    What I would like to do is be able to input the value with the dash (J-840) but change the SQL above so that it queries J840, i.e. all values without a dash. Is this possible?
    Any help is greatly appreciated,
    Kirk

    Try This
    SELECT *
      FROM rem_rp_tract@DBLINK_WPC29_G6CEFMP1.NWO.USACE.ARMY.MIL "REM_RP_TRACT"
    WHERE "REM_RP_TRACT"."PROJ_ID" = upper(:P2_PROJECT_CODE)
       AND "REM_RP_TRACT"."TRACT_NO" = REPLACE(upper(:P2_TRACTNO),'-')
    SQL> var myvar varchar2(20);
    SQL> exec :myvar:='J-840' ;
    PL/SQL procedure successfully completed.
    SQL> select :myvar , replace(:myvar,'-') from dual ;
    :MYVAR                           REPLACE(:MYVAR,'-')
    J-840                            J840Replace the - in the string to null.
    SS

  • Enhance a SQL query with update of millions of rows

    Hi ,
    I have this query developed to updated around 200 million of rows on my production , I did my best but please need your recommendations\concerns to make it more enhanced
    DECLARE @ORIGINAL_ID AS BIGINT
    SELECT FID001 INTO #Temp001_
    FROM INBA004 WHERE RS_DATE>='1999-01-01'
    AND RS_DATE<'2014-01-01' AND CLR_f1st='SSLM'
    and FID001 >=12345671
    WHILE (SELECT COUNT(*) FROM #Temp001_ ) <>0
    BEGIN
    SELECT TOP 1 @ORIGINAL_ID=FID001 FROM #Temp001_ ORDER BY FID001
    PRINT CAST (@ORIGINAL_ID AS VARCHAR(100))+' STARTED'
    SELECT DISTINCT FID001
    INTO #OUT_FID001
    FROM OUTTR009 WHERE TRANSACTION_ID IN (SELECT TRANSACTION_ID FROM
    INTR00100 WHERE FID001 = @ORIGINAL_ID)
    UPDATE A SET RCV_Date=B.TIME_STAMP
    FROM OUTTR009 A INNER JOIN INTR00100 B
    ON A.TRANSACTION_ID=B.TRANSACTION_ID
    WHERE A.FID001 IN (SELECT FID001 FROM #OUT_FID001)
    AND B.FID001=@ORIGINAL_ID
    UPDATE A SET Sending_Date=B.TIME_STAMP
    FROM INTR00100 A INNER JOIN OUTTR009 B
    ON A.TRANSACTION_ID=B.TRANSACTION_ID
    WHERE A.FID001=@ORIGINAL_ID
    AND B.FID001 IN (SELECT FID001 FROM #OUT_FID001)
    DELETE FROM #Temp001_ WHERE FID001=@ORIGINAL_ID
    DROP TABLE #OUT_FID001
    PRINT CAST (@ORIGINAL_ID AS VARCHAR(100))+' FINISHED'
    END

    DECLARE @x INT
    SET @x = 1
    WHILE @x < 44,000,000  -- Set appropriately
    BEGIN
        UPDATE Table SET a = c+d where ID BETWEEN @x AND @x + 10000
        SET @x = @x + 10000
    END
    Make sure that ID column has a CI on.
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • SQL Query for update

    hi experts
    I got two tables
    BOOK (DDC,TITLE,ISBN,AUTH_NAME)
    AUTHOR (ID,DDC,AUTH_NAME)
    AUTH_NAME column in BOOK's table contains NULL for all records.
    I want update table BOOK's column AUTH_NAME from AUTHOR's column in AUTHOR table where DDC numbers match. DDC is not unique in AUTHOR's table. I want to update BOOK table with the first matching AUTH_NAME. Rest should be ignored.
    Please write me the query for it.
    thanks

    Please write me the query for it.This fellow has no questions.
    Please, DO NOT ANNOY HIM with hints and tips, he just wants his answer. ; )
    I suspect it's homework, just another cheating student, earning his OCP.
    He is very anxious to get somebody to do his work, as he has spammed this same questtion on several other Oracle forums:
    http://dba.ipbhost.com/index.php?showtopic=10441
    http://www.dba-village.com/village/dvp_forum.OpenThread?ThreadIdA=32264

  • SQL query for updating values in same cell of a table

    Hi All,
    I'm stuck with a problem and it stands as follows:
    Table name: Track
    Part1  Part2  Part3
    NULL   NULL   NULL
    I've a table called Track, which has three columns named Part1, Part2 and Part3. I want all values of Part1 to be separated by a comma (,); it should not be overwritten, neither they should appear in separate row, in fact they should look like this:
    Part1    Part2    Part3
    1,2,3    5          SUBM1
    The new values of Part1 should appear in next row only when value of Part3 changes, so if Part3 changes from SUBM1 to SUBM2, it should look like this:
    Part1    Part2    Part3
    1,2,3    5          SUBM1
    1,2,3    5          SUBM2
    Count of values in Part1 never exceeds the value of Part2, so if Part2 is 5, then Part1 will look like 1,2,3,4,5. So in other words loop will run only up to the value of Part2.
    Please advise how this could be achieved?
    Kind regards,
    Aniruddha Jagdale

    I've a table called Track, which has three columns named Part1, Part2 and Part3. I want all values of Part1 to be separated by a comma (,);
    No, don't go there.
    This breaks a fundamental point for relational databases: no repeating groups. A cell should hold an atomic value. And this is not only a matter of purism. Relational databases are designed from this principle, and breaking this means that you will need
    to write complex and higly inefficient code.
    The values in Part1 should be in a separate table, with one value per row.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Expand Sql query to retrieve items of a workbook

    Hi All,
    I have come across the forum a code to retrieve the items of a workbook.
    In the code it's retrieving up to 21 items.
    I would like to expand the code to retrieve 35 items.
    I don't really understand the parameters used so that i can expand it on my on.
    This is the code I am using now, which I got from this forum:
    SELECT
    QS.QS_DOC_OWNER USER_NAME,
    QS.QS_DOC_NAME WORKBOOK,
    QS.QS_DOC_DETAILS WORKSHEET,
    TRUNC(QS.QS_CREATED_DATE) DOC_DATE,
    (LENGTH(TO_CHAR(EUL5_GET_ITEM_NAME(QS.QS_ID)))+1)/9 ITEMS,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),1, 6)) ITEM1,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),10, 6)) ITEM2,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),19, 6)) ITEM3,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),28, 6)) ITEM4,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),37, 6)) ITEM5,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),46, 6)) ITEM6,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),55, 6)) ITEM7,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),64, 6)) ITEM8,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),73, 6)) ITEM9,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),82, 6)) ITEM10,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),91, 6)) ITEM11,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),100,6)) ITEM12,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),109,6)) ITEM13,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),118,6)) ITEM14,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),127,6)) ITEM15,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),136,6)) ITEM16,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),145,6)) ITEM17,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),154,6)) ITEM18,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),163,6)) ITEM19,
    EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),172,6)) ITEM20
    FROM discoverer.EUL5_QPP_STATS QS
    WHERE
    (LENGTH(TO_CHAR(EUL5_GET_ITEM_NAME(QS.QS_ID)))+1)/9 < 21
    And QS.QS_DOC_OWNER = 'EP'
    and QS.QS_DOC_NAME like '%Prodoper%'Thanks,
    Diana

    This should do the trick...
    SELECT QS.QS_DOC_OWNER USER_NAME,
           QS.QS_DOC_NAME WORKBOOK,
           QS.QS_DOC_DETAILS WORKSHEET,
           TRUNC(QS.QS_CREATED_DATE) DOC_DATE,
           (LENGTH(TO_CHAR(EUL5_GET_ITEM_NAME(QS.QS_ID)))+1)/9 ITEMS,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),1, 6)) ITEM1,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),10, 6)) ITEM2,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),19, 6)) ITEM3,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),28, 6)) ITEM4,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),37, 6)) ITEM5,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),46, 6)) ITEM6,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),55, 6)) ITEM7,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),64, 6)) ITEM8,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),73, 6)) ITEM9,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),82, 6)) ITEM10,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),91, 6)) ITEM11,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),100,6)) ITEM12,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),109,6)) ITEM13,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),118,6)) ITEM14,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),127,6)) ITEM15,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),136,6)) ITEM16,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),145,6)) ITEM17,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),154,6)) ITEM18,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),163,6)) ITEM19,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),172,6)) ITEM20,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),181,6)) ITEM21,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),190,6)) ITEM22,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),199,6)) ITEM23,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),208,6)) ITEM24,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),217,6)) ITEM25,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),226,6)) ITEM26,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),235,6)) ITEM27,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),244,6)) ITEM28,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),253,6)) ITEM29,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),262,6)) ITEM30,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),271,6)) ITEM31,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),280,6)) ITEM32,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),289,6)) ITEM33,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),298,6)) ITEM34,
           EUL5_GET_ITEM(SUBSTR(EUL5_GET_ITEM_NAME(QS.QS_ID),307,6)) ITEM35,
    FROM   discoverer.EUL5_QPP_STATS QS
    WHERE  (LENGTH(TO_CHAR(EUL5_GET_ITEM_NAME(QS.QS_ID)))+1)/9 < 36
    AND    QS.QS_DOC_OWNER = 'EP'
    AND    QS.QS_DOC_NAME like '%Prodoper%'To provide some explanation, this little bit:
    EUL5_GET_ITEM_NAME(QS.QS_ID)returns a comma separated list of 8-digit Item IDs used in a worksheet.
    So, the "ITEMS" column simply gets the overall length of the string and divides by 9 (8 digit ID + 1 digit comma) to determine the number of items in the worksheet.
    All of the "ITEMXX" columns are extracting the useful part of each Item ID (which happens to be the first 6 digits of the Item ID) via the SUBSTR function where the starting point is incremented by 9 each time it is called.
    Lastly, there is a condition to only return records when there are less than X number of items, 36 in this case.

Maybe you are looking for

  • Cannot uninstall because I get a message to close Firefox first, but it is not open

    Firefox stopped working, I tried to uninstall it and because I thought something was corrupted. It will not let me unistall because I am told to close Firefox first. I cannot find firefox, nor can I close it. I think that it is gone, but it still app

  • Javascript generated validation error message not rendering properly.

    Hi guys. I am a web developer looking for some help with a Safari issue. I have a web form with client side validation. The page is built in asp.net and uses a validation summary to display the error messages in an unordered list. The validation is n

  • How to put (reload) imessages on another idevice

    i lost my iphone, so i want to put my old messages on my ipad so i can get in contact with my family again. Help me please

  • Pages - delete text box

    Am I being really dim? I want to delete a text box from my document, I can't figure it out. It just says 'text' inside it. It doesn't show when I print the page, but it's bugging me. Thanks.

  • Need Tools

    I have no Tools. How do I get them? I want to be able to delete pages in a pdf file.Creating, Editing & Exporting PDFs