Discoverer Report - SQL Query to retrieve list of parameters

Hi
We have around 100 Discoverer reports and I'm trying to find the list of parameters used in each report.
Is there any SQL query that I can use to find the parameters used for each report
or
should I open the reports one by one to fetch the list of parameters used.
I checked the tables in EUL4_US schema but no luck.
- Amarnath.K

give this a try for starters. It looks at the custom folders defined in the business area, which is where any LOV's defined for you parameters would be. As far as looking at the workbooks themselves, no, there is no way to do that in sql.
select
decode(eb.ba_created_by,'ORACLE_APPS','Seeded','Custom') Origin,
eb.ba_name business_area,
eo.OBJ_TYPE,
decode(eo.obj_type, 'SOBJ','From Database', 'CUO', 'Custom Query', 'COBJ', 'Complex Folder', eo.obj_type) obj_type_desc,
eo.OBJ_NAME folder,
eo.OBJ_DESCRIPTION folder_description,
decode(eo.sobj_ext_table, NULL, NULL, eo.obj_ext_owner || '.' || eo.sobj_ext_table) base_object,
decode(es.seg_obj_id, null, UPPER(trim(eo.obj_object_sql1)||trim(eo.obj_object_sql2)||trim(eo.obj_object_sql3))
, UPPER(trim(es.seg_chunk1) || trim(es.seg_chunk2) || trim(es.seg_chunk3) || trim(es.seg_chunk4))) SQL
from
eul4_us.EUL5_BAS eb,
eul4_us.EUL5_objs eo,
eul4_us.EUL5_BA_OBJ_LINKS ebol,
eul4_us.eul5_segments es
where
eb.BA_ID = ebol.BOL_BA_ID and
ebol.BOL_OBJ_ID = eo.OBJ_ID and
eo.obj_id = es.seg_obj_id (+) and
decode(eb.ba_created_by,'ORACLE_APPS','Seeded','Custom') = 'Custom'
order by
/*decode(eb.ba_created_by,'ORACLE_APPS','Seeded','Custom'), */eb.ba_name, ebol.BOL_SEQUENCE, es.seg_sequence

Similar Messages

  • App-V Reporting: SQL query for Excel Pivot Table to display App Usage (H/M/S)

    I recently posted this in the Gallery.  If anyone has any modifications or enhancements please feel free to contribute!  One thing that I'd like to be able to add to it is the ability to only display information for applications/packages that are
    still published, so if anyone can figure out a crafty way to do it...  Thanks!
    http://gallery.technet.microsoft.com/App-V-Reporting-SQL-query-6695d3c3

    I recently posted this in the Gallery.  If anyone has any modifications or enhancements please feel free to contribute!  One thing that I'd like to be able to add to it is the ability to only display information for applications/packages that are
    still published, so if anyone can figure out a crafty way to do it...  Thanks!
    http://gallery.technet.microsoft.com/App-V-Reporting-SQL-query-6695d3c3

  • SQL query to retrieve totals from "supporting Details"

    We've had a strange issue where the totals from the supporting details aren't adding up to the value submitted in essbase.
    In effect our RDMS is out of sync with Planning.
    In order to remedy this, I'm trying to build a SQL query to retrieve the value of the supporting details.
    Here is my Sql statement so far :
    SELECT
    HO1.OBJECT_NAME SCENARIO,
    HO2.OBJECT_NAME ACCOUNT,
    HO3.OBJECT_NAME ENTITY,
    HO4.OBJECT_NAME Month,
    HO5.OBJECT_NAME Version,
    HO6.OBJECT_NAME Currency,
    HO7.OBJECT_NAME Year,
    HO8.OBJECT_NAME Project,
    HO10.OBJECT_NAME CC,
    HO12.OBJECT_NAME Grplcl,
    HO13.OBJECT_NAME Product,
    HO15.OBJECT_NAME SalesRegion,
    HO16.OBJECT_NAME ContractAnalysis,
    HO17.OBJECT_NAME IC,
    SUM(NVL(HCDI.VALUE,0)) AMOUNT
    FROM hsp_column_detail HCD,
    hsp_column_detail_ITEM HCDI,
    HSP_OBJECT HO1,
    HSP_OBJECT HO2,
    HSP_OBJECT HO3,
    HSP_OBJECT HO4,
    HSP_OBJECT HO5,
    HSP_OBJECT HO6,
    HSP_OBJECT HO7,
    HSP_OBJECT HO8,
    HSP_OBJECT HO10,
    HSP_OBJECT HO12,
    HSP_OBJECT HO13,
    HSP_OBJECT HO15,
    HSP_OBJECT HO16,
    HSP_OBJECT HO17
    WHERE hcd.detail_id = hcdi.detail_id
    AND hcd.dim1 = ho1.object_id
    AND hcd.dim2 = ho2.object_id
    AND hcd.dim3 = ho3.object_id
    AND hcd.dim4 = ho4.object_id
    AND hcd.dim5 = ho5.object_id
    AND hcd.dim6 = ho6.object_id
    AND hcd.dim7 = ho7.object_id
    AND hcd.dim8 = ho8.object_id
    AND hcd.dim10 = ho10.object_id
    AND hcd.dim12 = ho12.object_id
    AND hcd.dim13 = ho13.object_id
    AND hcd.dim15 = ho15.object_id
    AND hcd.dim16 = ho16.object_id
    AND hcd.dim17 = ho17.object_id
    and hcdi.generation = 0
    GROUP BY HO1.OBJECT_NAME, HO2.OBJECT_NAME, HO3.OBJECT_NAME, HO4.OBJECT_NAME,
    HO5.OBJECT_NAME,
    HO6.OBJECT_NAME,
    HO7.OBJECT_NAME,
    HO8.OBJECT_NAME,
    HO10.OBJECT_NAME,
    HO12.OBJECT_NAME,
    HO13.OBJECT_NAME,
    HO15.OBJECT_NAME,
    HO16.OBJECT_NAME,
    HO17.OBJECT_NAME
    ORDER BY HO1.OBJECT_NAME, HO3.OBJECT_NAME, HO2.OBJECT_NAME

    This query works using PL SQL and has been used on Oracle 9.2.3.
    Cheers,
    Jeremie
    Here is the Query:
    set serveroutput on;
    set serveroutput on size 1000000;
    --set buffer_size 10000000;
    --set line_size 2000;
    --DBMS_OUTPUT.size = 2000000;
    DECLARE
    CURSOR BUDGET_HEADERS_CU IS
    SELECT
    hcd.detail_id,
    HO1.OBJECT_NAME SCENARIO,
    HO2.OBJECT_NAME ACCOUNT,
    HO3.OBJECT_NAME ENTITY,
    HO4.OBJECT_NAME Month,
    HO5.OBJECT_NAME Version,
    HO6.OBJECT_NAME Currency,
    HO7.OBJECT_NAME Year,
    HO8.OBJECT_NAME Project,
    HO10.OBJECT_NAME CC,
    HO12.OBJECT_NAME Grplcl,
    HO13.OBJECT_NAME Product,
    HO15.OBJECT_NAME SalesRegion,
    HO16.OBJECT_NAME ContractAnalysis,
    HO17.OBJECT_NAME IC,
    hcd.dim1 SCENARIO_id,
    hcd.dim2 ACCOUNT_id,
    hcd.dim3 ENTITY_id,
    hcd.dim4 Month_id,
    hcd.dim5 Version_id,
    hcd.dim6 Currency_ID,
    hcd.dim7 Year_ID,
    hcd.dim8 Project_ID,
    hcd.dim10 CC_ID,
    hcd.dim12 Grplcl_ID,
    hcd.dim13 Product_ID,
    hcd.dim15 SalesRegion_ID,
    hcd.dim16 ContractAnalysis_ID,
    hcd.dim17 IC_ID
    FROM hsp_column_detail HCD, /*hsp_column_detail_item HCDi,*/
    HSP_OBJECT HO1,
    HSP_OBJECT HO2,
    HSP_OBJECT HO3,
    HSP_OBJECT HO4,
    HSP_OBJECT HO5,
    HSP_OBJECT HO6,
    HSP_OBJECT HO7,
    HSP_OBJECT HO8,
    HSP_OBJECT HO10,
    HSP_OBJECT HO12,
    HSP_OBJECT HO13,
    HSP_OBJECT HO15,
    HSP_OBJECT HO16,
    HSP_OBJECT HO17
    WHERE /*hcd.detail_id = hcdi.detail_id
    AND*/ hcd.dim1 = ho1.object_id
    AND hcd.dim2 = ho2.object_id
    AND hcd.dim3 = ho3.object_id
    AND hcd.dim4 = ho4.object_id
    AND hcd.dim5 = ho5.object_id
    AND hcd.dim6 = ho6.object_id
    AND hcd.dim7 = ho7.object_id
    AND hcd.dim8 = ho8.object_id
    AND hcd.dim10 = ho10.object_id
    AND hcd.dim12 = ho12.object_id
    AND hcd.dim13 = ho13.object_id
    AND hcd.dim15 = ho15.object_id
    AND hcd.dim16 = ho16.object_id
    AND hcd.dim17 = ho17.object_id
    and HO5.OBJECT_NAME = 'Working'
    --and hcdi.generation != 0
    --and hcdi.label like 'JRTEST-%'
    --and hcd.detail_id = 253102
    /*GROUP BY HCD.Dim1, HCD.Dim2, HCD.Dim3, HCD.Dim4,
    HCD.Dim5,
    HCD.Dim6,
    HCD.Dim7,
    HCD.Dim8,
    HCD.Dim10,
    HCD.Dim12,
    HCD.Dim13,
    HCD.Dim15,
    HCD.Dim16,
    HCD.Dim17*/;
    CURSOR BUDGET_DETAILS_CU(
    /*scenario_p in varchar2,
    account_p in varchar2,
    entity_p in varchar2,
    month_p in varchar2,
    version_p in varchar2,
    currency_p in varchar2,
    year_p in varchar2,
    project_p in varchar2,
    cc_p in varchar2,
    grplcl_p in varchar2,
    product_p in varchar2,
    salesregion_p in varchar2,
    contractanalysis_p in varchar2,
    ic_p in varchar2*/
    detail_id_p in number
    IS
    SELECT
    /* HO1.OBJECT_NAME SCENARIO,
    HO2.OBJECT_NAME ACCOUNT,
    HO3.OBJECT_NAME ENTITY,
    HO4.OBJECT_NAME Month,
    HO5.OBJECT_NAME Version,
    HO6.OBJECT_NAME Currency,
    HO7.OBJECT_NAME Year,
    HO8.OBJECT_NAME Project,
    HO10.OBJECT_NAME CC,
    HO12.OBJECT_NAME Grplcl,
    HO13.OBJECT_NAME Product,
    HO15.OBJECT_NAME SalesRegion,
    HO16.OBJECT_NAME ContractAnalysis,
    HO17.OBJECT_NAME IC, */
    label,
    NVL(HCDI.VALUE,0) AMOUNT,
    HCDI.Position,
    HCDI.operator,
    HCDI.generation
    FROM /*hsp_column_detail HCD,*/
    hsp_column_detail_ITEM HCDI
    /* HSP_OBJECT HO1,
    HSP_OBJECT HO2,
    HSP_OBJECT HO3,
    HSP_OBJECT HO4,
    HSP_OBJECT HO5,
    HSP_OBJECT HO6,
    HSP_OBJECT HO7,
    HSP_OBJECT HO8,
    HSP_OBJECT HO10,
    HSP_OBJECT HO12,
    HSP_OBJECT HO13,
    HSP_OBJECT HO15,
    HSP_OBJECT HO16,
    HSP_OBJECT HO17*/
    --WHERE hcd.detail_id = hcdi.detail_id
    WHERE hcdi.detail_id = detail_id_p
    /*AND hcd.dim1 = ho1.object_id
    AND hcd.dim2 = ho2.object_id
    AND hcd.dim3 = ho3.object_id
    AND hcd.dim4 = ho4.object_id
    AND hcd.dim5 = ho5.object_id
    AND hcd.dim6 = ho6.object_id
    AND hcd.dim7 = ho7.object_id
    AND hcd.dim8 = ho8.object_id
    AND hcd.dim10 = ho10.object_id
    AND hcd.dim12 = ho12.object_id
    AND hcd.dim13 = ho13.object_id
    AND hcd.dim15 = ho15.object_id
    AND hcd.dim16 = ho16.object_id
    AND hcd.dim17 = ho17.object_id*/
    --and hcdi.generation != 0
    --and label like 'JRTEST-%'
    /*AND HCD.Dim1 = scenario_p
    AND HCD.Dim2 = account_p
    AND HCD.Dim3 = entity_p
    AND HCD.Dim4 = month_p
    AND HCD.Dim5 = version_p
    AND HCD.Dim6 = currency_p
    AND HCD.Dim7 = year_p
    AND HCD.Dim8 = project_p
    AND HCD.Dim10 = cc_p
    AND HCD.Dim12 = grplcl_p
    AND HCD.Dim13 = product_p
    AND HCD.Dim15 = salesregion_p
    AND HCD.Dim16 = contractanalysis_p
    AND HCD.Dim17 = ic_p*/
    ORDER BY hcdi.position;
    -- Variable Declaration
    running_total_ln number :=0;
    prev_running_total_ln number :=0;
    add_amount number :=0;
    multiply_amount number :=1;
    prev_generation number :=0;
    prev_add_amount number :=0;
    prev_multiply_amount number :=1;
    running_total_gen0 number :=0;
    running_gen0_op number :=0;
    running_total_gen1 number :=0;
    running_gen1_op number :=0;
    running_total_gen2 number :=0;
    running_gen2_op number :=0;
    running_total_gen3 number :=0;
    running_gen3_op number :=0;
    running_total_gen4 number :=0;
    running_gen4_op number :=0;
    running_total_gen5 number :=0;
    running_gen5_op number :=0;
    output_file utl_file.file_type;
    -- Begin PL/SQL processing
    BEGIN
    --DBMS_OUTPUT.
    DBMS_OUTPUT.ENABLE(1000000);
    DBMS_OUTPUT.PUT_LINE('Begin Processing');
    output_file := utl_file.fopen ('C:\temp', 'test.txt', 'W');
    -- Begin Header For Loop
    FOR BUDGET_HEADERS_CV IN BUDGET_HEADERS_CU
    LOOP
    --Reset Running Totals
    running_total_ln:=0;
    prev_running_total_ln:=0;
    add_amount:=0;
    multiply_amount:=1;
    prev_generation:=0;
    prev_add_amount:=0;
    prev_multiply_amount:=1;
    running_total_gen0:=0;
    running_gen0_op:=0;
    running_total_gen1:=0;
    running_gen1_op:=0;
    running_total_gen2:=0;
    running_gen2_op:=0;
    running_total_gen3:=0;
    running_gen3_op:=0;
    running_total_gen4:=0;
    running_gen4_op:=0;
    running_total_gen5:=0;
    running_gen5_op:=0;
    -- Begin Detail For Loop
    FOR BUDGET_DETAILS_CV IN BUDGET_DETAILS_CU(
    BUDGET_HEADERS_CV.Detail_ID
    /*BUDGET_HEADERS_CV.SCENARIO_ID,
    BUDGET_HEADERS_CV.ACCOUNT_ID,
    BUDGET_HEADERS_CV.ENTITY_ID,
    BUDGET_HEADERS_CV.Month_ID,
    BUDGET_HEADERS_CV.Version_ID,
    BUDGET_HEADERS_CV.Currency_ID,
    BUDGET_HEADERS_CV.Year_ID,
    BUDGET_HEADERS_CV.Project_ID,
    BUDGET_HEADERS_CV.CC_ID,
    BUDGET_HEADERS_CV.Grplcl_ID,
    BUDGET_HEADERS_CV.Product_ID,
    BUDGET_HEADERS_CV.SalesRegion_ID,
    BUDGET_HEADERS_CV.ContractAnalysis_ID,
    BUDGET_HEADERS_CV.IC_ID*/
    LOOP
    -- Null;
    add_amount :=0;
    multiply_amount :=1;
    IF BUDGET_DETAILS_CV.OPERATOR = 1 THEN
    add_amount := BUDGET_DETAILS_CV.Amount;
    End if;
    IF BUDGET_DETAILS_CV.OPERATOR = 2 THEN
    add_amount := BUDGET_DETAILS_CV.Amount * -1;
    End if;
    IF BUDGET_DETAILS_CV.OPERATOR = 3 THEN
    multiply_amount := BUDGET_DETAILS_CV.Amount;
    End if;
    IF BUDGET_DETAILS_CV.OPERATOR = 4 THEN
    multiply_amount := 1/BUDGET_DETAILS_CV.Amount;
    End if;
    IF BUDGET_DETAILS_CV.Position = 0 then
    running_total_gen0 := add_amount*multiply_amount;-- we are dealing with the first line
    Else
    if BUDGET_DETAILS_CV.GENERATION = prev_generation then
    -- run whatever total we are on up
    if BUDGET_DETAILS_CV.GENERATION = 0 then
    running_total_gen0 := (running_total_gen0 + add_amount)*multiply_amount;
    end if;
    if BUDGET_DETAILS_CV.GENERATION = 1 then
    running_total_gen1 := (running_total_gen1 + add_amount)*multiply_amount;
    end if;
    if BUDGET_DETAILS_CV.GENERATION = 2 then
    running_total_gen2 := (running_total_gen2 + add_amount)*multiply_amount;
    end if;
    if BUDGET_DETAILS_CV.GENERATION = 3 then
    running_total_gen3 := (running_total_gen3 + add_amount)*multiply_amount;
    end if;
    end if;
    if BUDGET_DETAILS_CV.GENERATION = prev_generation +1 then
    -- we are going up a generation
    -- (we cannot go up to gen0
    if BUDGET_DETAILS_CV.GENERATION = 1 then
    running_total_gen1:=0;-- reset gen1 counter
    running_gen0_op:=BUDGET_DETAILS_CV.OPERATOR; -- Store the sign for later operation
    running_total_gen0 := running_total_gen0/prev_multiply_amount - prev_add_amount; -- Remove parent from Gen 0 total
    running_total_gen1 := (running_total_gen1 + add_amount)*multiply_amount;
    end if;
    if BUDGET_DETAILS_CV.GENERATION = 2 then
    running_total_gen2:=0;-- reset gen1 counter
    running_gen1_op:=BUDGET_DETAILS_CV.OPERATOR; -- Store the sign for later operation
    running_total_gen1 := running_total_gen1/prev_multiply_amount - prev_add_amount; -- Remove parent from Gen 1 total
    running_total_gen2 := (running_total_gen2 + add_amount)*multiply_amount;
    end if;
    if BUDGET_DETAILS_CV.GENERATION = 3 then
    running_total_gen3:=0;-- reset gen1 counter
    running_gen2_op:=BUDGET_DETAILS_CV.OPERATOR; -- Store the sign for later operation
    running_total_gen2 := running_total_gen2/prev_multiply_amount - prev_add_amount; -- Remove parent from Gen 2 total
    running_total_gen3 := (running_total_gen3 + add_amount)*multiply_amount;
    end if;
    end if;
    if BUDGET_DETAILS_CV.GENERATION = prev_generation - 1 then
    -- we are Down a generation
    if BUDGET_DETAILS_CV.GENERATION = 0 then
    --we need to "add" back the previous gen 1 parent
    IF running_gen0_op = 1 THEN
    running_total_gen0 := running_total_gen0 + running_total_gen1;
    End if;
    IF running_gen0_op = 2 THEN
    running_total_gen0 := running_total_gen0 - running_total_gen1;
    End if;
    IF running_gen0_op = 3 THEN
    running_total_gen0 := running_total_gen0 * running_total_gen1;
    End if;
    IF running_gen0_op = 4 THEN
    running_total_gen0 := running_total_gen0 / running_total_gen1;
    End if;
    -- we need to add the current member to the gen0
    running_total_gen0 := (running_total_gen0 + add_amount)*multiply_amount;
    END IF;
    if BUDGET_DETAILS_CV.GENERATION = 1 then
    --we need to "add" back the previous gen 2 parent
    IF running_gen1_op = 1 THEN
    running_total_gen1 := running_total_gen1 + running_total_gen2;
    End if;
    IF running_gen1_op = 2 THEN
    running_total_gen1 := running_total_gen1 - running_total_gen2;
    End if;
    IF running_gen1_op = 3 THEN
    running_total_gen1 := running_total_gen1 * running_total_gen2;
    End if;
    IF running_gen1_op = 4 THEN
    running_total_gen1 := running_total_gen1 / running_total_gen2;
    End if;
    -- we need to add the current member to the gen1
    running_total_gen1 := (running_total_gen1 + add_amount)*multiply_amount;
    end if;
    if BUDGET_DETAILS_CV.GENERATION = 2 then
    --we need to "add" back the previous gen 3 parent
    IF running_gen1_op = 1 THEN
    running_total_gen2 := running_total_gen2 + running_total_gen3;
    End if;
    IF running_gen1_op = 2 THEN
    running_total_gen2 := running_total_gen2 - running_total_gen3;
    End if;
    IF running_gen1_op = 3 THEN
    running_total_gen2 := running_total_gen2 * running_total_gen3;
    End if;
    IF running_gen1_op = 4 THEN
    running_total_gen2 := running_total_gen2 / running_total_gen3;
    End if;
    -- we need to add the current member to the gen2
    running_total_gen2 := (running_total_gen2 + add_amount)*multiply_amount;
    end if;
    end if;
    if BUDGET_DETAILS_CV.GENERATION = prev_generation - 2 then
    -- we are Down 2 generations
    if BUDGET_DETAILS_CV.GENERATION = 0 then
    --we need to "add" back the previous gen 2 parent
    IF running_gen1_op = 1 THEN
    running_total_gen1 := running_total_gen1 + running_total_gen2;
    End if;
    IF running_gen1_op = 2 THEN
    running_total_gen1 := running_total_gen1 - running_total_gen2;
    End if;
    IF running_gen1_op = 3 THEN
    running_total_gen1 := running_total_gen1 * running_total_gen2;
    End if;
    IF running_gen1_op = 4 THEN
    running_total_gen1 := running_total_gen1 / running_total_gen2;
    End if;
    --we need to "add" back the previous gen 1 parent
    IF running_gen0_op = 1 THEN
    running_total_gen0 := running_total_gen0 + running_total_gen1;
    End if;
    IF running_gen0_op = 2 THEN
    running_total_gen0 := running_total_gen0 - running_total_gen1;
    End if;
    IF running_gen0_op = 3 THEN
    running_total_gen0 := running_total_gen0 * running_total_gen1;
    End if;
    IF running_gen0_op = 4 THEN
    running_total_gen0 := running_total_gen0 / running_total_gen1;
    End if;
    -- we need to add the current member to the gen0
    running_total_gen0 := (running_total_gen0 + add_amount)*multiply_amount;
    END IF;
    if BUDGET_DETAILS_CV.GENERATION = 1 then
    --we need to "add" back the previous gen 3 parent
    IF running_gen1_op = 1 THEN
    running_total_gen2 := running_total_gen2 + running_total_gen3;
    End if;
    IF running_gen1_op = 2 THEN
    running_total_gen2 := running_total_gen2 - running_total_gen3;
    End if;
    IF running_gen1_op = 3 THEN
    running_total_gen2 := running_total_gen2 * running_total_gen3;
    End if;
    IF running_gen1_op = 4 THEN
    running_total_gen2 := running_total_gen2 / running_total_gen3;
    End if;
    --we need to "add" back the previous gen 2 parent
    IF running_gen1_op = 1 THEN
    running_total_gen1 := running_total_gen1 + running_total_gen2;
    End if;
    IF running_gen1_op = 2 THEN
    running_total_gen1 := running_total_gen1 - running_total_gen2;
    End if;
    IF running_gen1_op = 3 THEN
    running_total_gen1 := running_total_gen1 * running_total_gen2;
    End if;
    IF running_gen1_op = 4 THEN
    running_total_gen1 := running_total_gen1 / running_total_gen2;
    End if;
    -- we need to add the current member to the gen1
    running_total_gen1 := (running_total_gen1 + add_amount)*multiply_amount;
    END IF;
    if BUDGET_DETAILS_CV.GENERATION = prev_generation - 3 then
    -- we are Down 3 generations
    if BUDGET_DETAILS_CV.GENERATION = 0 then
    --we need to "add" back the previous gen 3 parent
    IF running_gen1_op = 1 THEN
    running_total_gen2 := running_total_gen2 + running_total_gen3;
    End if;
    IF running_gen1_op = 2 THEN
    running_total_gen2 := running_total_gen2 - running_total_gen3;
    End if;
    IF running_gen1_op = 3 THEN
    running_total_gen2 := running_total_gen2 * running_total_gen3;
    End if;
    IF running_gen1_op = 4 THEN
    running_total_gen2 := running_total_gen2 / running_total_gen3;
    End if;
    --we need to "add" back the previous gen 2 parent
    IF running_gen1_op = 1 THEN
    running_total_gen1 := running_total_gen1 + running_total_gen2;
    End if;
    IF running_gen1_op = 2 THEN
    running_total_gen1 := running_total_gen1 - running_total_gen2;
    End if;
    IF running_gen1_op = 3 THEN
    running_total_gen1 := running_total_gen1 * running_total_gen2;
    End if;
    IF running_gen1_op = 4 THEN
    running_total_gen1 := running_total_gen1 / running_total_gen2;
    End if;
    --we need to "add" back the previous gen 1 parent
    IF running_gen0_op = 1 THEN
    running_total_gen0 := running_total_gen0 + running_total_gen1;
    End if;
    IF running_gen0_op = 2 THEN
    running_total_gen0 := running_total_gen0 - running_total_gen1;
    End if;
    IF running_gen0_op = 3 THEN
    running_total_gen0 := running_total_gen0 * running_total_gen1;
    End if;
    IF running_gen0_op = 4 THEN
    running_total_gen0 := running_total_gen0 / running_total_gen1;
    End if;
    -- we need to add the current member to the gen0
    running_total_gen0 := (running_total_gen0 + add_amount)*multiply_amount;
    END IF;
    end if;
    END IF;
    End IF;
    END LOOP; -- End of Detail Loop
    --DBMS_OUTPUT.PUT_LINE(BUDGET_HEADERS_CV.SCENARIO||';'||BUDGET_HEADERS_CV.ACCOUNT||';'||BUDGET_HEADERS_CV.ENTITY||';'||BUDGET_HEADERS_CV.Month||';'||BUDGET_HEADERS_CV.Version||';'||BUDGET_HEADERS_CV.Currency||';'||BUDGET_HEADERS_CV.Year||';'||BUDGET_HEADERS_CV.Project||';'||BUDGET_HEADERS_CV.CC||';'||BUDGET_HEADERS_CV.Grplcl||';'||BUDGET_HEADERS_CV.Product||';'||BUDGET_HEADERS_CV.SalesRegion||';'||BUDGET_HEADERS_CV.ContractAnalysis||';'||BUDGET_HEADERS_CV.IC||';'||running_total_gen0);
    utl_file.put_line(output_file,BUDGET_HEADERS_CV.SCENARIO||';'||BUDGET_HEADERS_CV.ACCOUNT||';'||BUDGET_HEADERS_CV.ENTITY||';'||BUDGET_HEADERS_CV.Month||';'||BUDGET_HEADERS_CV.Version||';'||BUDGET_HEADERS_CV.Currency||';'||BUDGET_HEADERS_CV.Year||';'||BUDGET_HEADERS_CV.Project||';'||BUDGET_HEADERS_CV.CC||';'||BUDGET_HEADERS_CV.Grplcl||';'||BUDGET_HEADERS_CV.Product||';'||BUDGET_HEADERS_CV.SalesRegion||';'||BUDGET_HEADERS_CV.ContractAnalysis||';'||BUDGET_HEADERS_CV.IC||';'||running_total_gen0);
    /*BUDGET_HEADERS_CV.SCENARIO, BUDGET_HEADERS_CV.ACCOUNT, BUDGET_HEADERS_CV.ENTITY, BUDGET_HEADERS_CV.Month, BUDGET_HEADERS_CV.Version,BUDGET_HEADERS_CV.Currency, BUDGET_HEADERS_CV.Year, BUDGET_HEADERS_CV.Project, BUDGET_HEADERS_CV.CC, BUDGET_HEADERS_CV.Grplcl, BUDGET_HEADERS_CV.Product, BUDGET_HEADERS_CV.SalesRegion, BUDGET_HEADERS_CV.ContractAnalysis, BUDGET_HEADERS_CV.IC */
    END LOOP; -- End of Header Loop
    --DBMS_OUTPUT.PUT_LINE('Total');
    -- DBMS_OUTPUT.PUT_LINE('End Processing');
    utl_file.fclose(output_file);
    END;
    Edited by: JeremieR on Apr 18, 2011 5:02 AM

  • SQL Query to retrieve the All records based on the Max Dates.

    Hello all,
    I am trying to retrieve the newest record based on the date field (  nextDate  ).
    Currently there are only 4 records in the MC_Maintenance table and two in the Machine table.
    Machine table
    MC_id             EquipID          
    1                      0227
    MC_id             EquipID
    2                     0228
    MC_Maintenance table
    Maint_id           MC_id             Next_maint                  
    1                      2                      08/25/2010     
    2                      2                      07/01/2010
    3                      1                      06/11/2010
    4                      1                      07/11/2010
    What I  am trying to accomplish is,
    list the two machines from the Machine table with the MAX(Next_maint) controlling the MC_Maintenance output list
    These are the records that I would like to Display.
    Maint_id           MC_id             Next_maint                  
    1                      2                      08/25/2010
    4                      1                      07/11/2010                 
    Below is the SQL Query
    SELECT
           MC.MC_ID as ID,
            MC.complete_Date as completed,
            MC.next_maint as nextDate,
            MC.maint_notes as Notes,
            MC.facility as Facility,
            M.EquipId,
            M.name as name,
            M.SerialNumber as SN,
            M.dept as dept,
            M.Freq as freq
            From  MC_Maintenance MC, Machine M
            where  MC.MC_ID =  M.MC_ID
    '           USING MAX(nextDate )
    Any ideas would help.
    TJ

    I would have thought that was a simple group by problem?
    SELECT M.EquipID, MC.MC_ID, Max(MC.next_maint)
    FROM MC_Maintenance MC INNER JOIN Machine M ON MC.MC_ID = M.MC_ID
    GROUP BY M.EquipID, MC.MC_ID

  • Query to retrieve list of ledgers accessible for a given Applications User

    We've a requirement to find the list of the accessible ledgers for a given Oracle Apps User.I'm from Oracle ATG team,not familiar with GL terminologies. Can someone help with the query to retrieve the ledgers accessible for a given user.In our code flow, we may not have the complete applications context. Is it possible to retrieve that list only with the username. If so, how to do that? Do i need to access some profile values?
    Thanks,
    Senthil

    select * from usr where usr.usr_key not in (
    select usr.usr_key from oiu, usr, obi, obj, ost
    where oiu.usr_key=usr.usr_key
    and oiu.obi_key=obi.obi_key
    and obi.obj_key=obj.obj_key
    and obj.obj_name = :obj_name
    and oiu.ost_key=ost.ost_key
    and ost.ost_status not in ('Revoked'))
    -Kevin

  • SQL query to retrieve families with only one generation from a family db

    Hi,
    I need to write an SQL query that would select families with only one generation ((which means a person - or a married couple - with kids) or (a person - or a married couple - with parents but no kids)) from a database containing families. The simplified db structure is:
    person:
    id - int, primary key
    siblings:
    id
    parent_id
    kid_id
    marriage
    id:
    husband_id
    wife_id
    Could anyone please help me? I dont really have any idea how to accomplish that...

    Hi,
    Welcome to the forum!
    Assuming that siblings (despite its name) contains only parent-child relationships, and that the parent_id could be either the mother or the father:
    WITH     got_tree     AS
         SELECT     CONNECT_BY_ROOT  s.parent_id     AS root_id
         ,     LEVEL                     AS lvl
         FROM          siblings     s
         LEFT OUTER JOIN     marriage     m     ON     s.parent_id     IN ( m.husband_id
                                                            , m.wife_id
         START WITH     parent_id     NOT IN     (  SELECT  kid_id
                                               FROM        siblings
         CONNECT BY     s.parent_id     IN ( PRIOR m.husband_id
                                , PRIOR m.wife_id
                                , PRIOR kid_id
    SELECT       root_id
    FROM       got_tree
    GROUP BY  root_id
    HAVING       MAX (lvl)     <= 2
    ;This will get a list of parents who may or may not have children, but who do not have either parents or grandchildren.
    To get their spouses and children (if any) you will have to join this result set to all the other tables. At that point, you can eliminate poeple who do not have ancestors themselves, but are married to people who have more than one generation of ancestors.
    The details of how to do that depend on the details of your tables. If you'd like help, then post a little sample data (CREATE TABLE and INSERT statements for all tables) and the results you want from that data.
    Edited by: Frank Kulash on Oct 14, 2009 4:05 PM
    I'd need sample data in order to test this, of course.

  • Need efficient SQL query to retrieve data for MLM website

    Table cd_members
    MemberID LeftID RightID
    1 2 3
    2 4 5
    3 6 7
    4 8 -
    5 - -
    6 - -
    7 - -
    8 9 10
    9 - -
    10 - -
    i want to execute a query to retrieve downline of a member say MemberID 2
    o/p should be Records with MemberID 4,5,8,9,10
    i am using this query but don't know how to start from MembeID=2
    select a.memberid, a.tradingid, a.refid, a.parentid, a.node, a.leftid, a.rightid, b.memberid from cd_members a, cd_members b
    where (a.leftid=b.memberid or a.rightid=b.memberid)

    Again, assuming that the number of levels is known, you can just do N self joins (note that I intentionally go one level further than necessary in this case
    SQL> ed
    Wrote file afiedt.buf
      1  with t
      2    as
      3   (
      4      select 1 person, 2 left, 3 right from dual union all
      5      select 2, 4, 5 from dual union all
      6      select 3, 6, 7 from dual union all
      7      select 4, 8, null from dual union all
      8      select 5, null, null from dual union all
      9      select 6, null, null from dual union all
    10      select 7, null, null from dual union all
    11      select 8, 9, 10 from dual union all
    12      select 9, null, null from dual union all
    13      select 10, null, null from dual
    14   )
    15   select t1.left, t1.right, t2.left, t2.right, t3.left, t3.right, t4.left, t
    4.right
    16     from t t1,
    17          t t2,
    18          t t3,
    19          t t4
    20    where t1.person = 2
    21      and t1.left = t2.person(+)
    22      and t2.left = t3.person(+)
    23*     and t3.left = t4.person(+)
    SQL> /
          LEFT      RIGHT       LEFT      RIGHT       LEFT      RIGHT       LEFT
         RIGHT
             4          5          8                     9         10Justin

  • Request for report SQL Query

    hi all,
    i created links for an element but for some element links the costing and balancing codes were mistakenly given wrong and the element links are plenty so i am unable to find which is wrongly given.
    can some 1 out there provide me with the sql query that will allow me to create a report to run and confirm all the links have costing and balancing codes for all the earnings or voluntary deduction elements.
    Thank you for reading my issue. plz help!

    See if the below helps.
    Change the business group id in the query below-
    select ppf.payroll_name   
    ,pj.name Job,hou.name HR_ORG,ppg.group_name People_Group  
    ,pel.employment_category
    ,hra.location_code 
    ,pet.element_name,pet.reporting_name,pec.classification_name  
    ,pel.costable_type 
    ,pel.link_to_all_payrolls_flag 
    ,pcak1.concatenated_segments Element_Cost_Segments   
    ,pcak1.segment1  
    ,pcak1.segment2  
    ,pcak1.segment3  
    ,pcak1.segment4  
    ,pcak1.segment5  
    ,pcak1.segment6  
    ,pcak1.segment7  
    ,pcak1.segment8  
    ,pcak2.concatenated_segments Balancing_Cost_Segments  
    ,pcak2.segment1  
    ,pcak2.segment2  
    ,pcak2.segment3  
    ,pcak2.segment4  
    ,pcak2.segment5  
    ,pcak2.segment6  
    ,pcak2.segment7  
    ,pcak2.segment8  
    from pay_element_links_f pel   
    ,apps.PAY_COST_ALLOCATION_KEYFLEX  pcak1    
    ,apps.PAY_COST_ALLOCATION_KEYFLEX  pcak2    
    ,pay_element_types_f pet   
    ,pay_payrolls_f ppf   
    ,pay_element_classifications pec   
    ,per_jobs pj  
    ,hr_all_organization_units hou  
    ,PAY_PEOPLE_GROUPS ppg  
    ,hr_locations_all hra 
    where pel.element_type_id = pet.element_type_id   
    and ppf.payroll_id(+)   = pel.payroll_id
    and pcak1.cost_allocation_keyflex_id(+) = pel.cost_allocation_keyflex_id     
    and pcak2.cost_allocation_keyflex_id(+) = pel.balancing_keyflex_id     
    and  pet.business_group_id = 0   
    and pet.classification_id = pec.classification_id   
    and pj.job_id(+) = pel.job_id  
    and hou.organization_id(+) = pel.organization_id  
    and ppg.people_group_id(+) = pel.people_group_id  
    and hra.location_id(+) = pel.location_id  
    and sysdate between pel.effective_start_date and pel.effective_end_date
    and sysdate between pet.effective_start_date and pet.effective_end_date
    and sysdate between ppf.effective_start_date(+) and ppf.effective_end_date(+)
    order by ppf.payroll_name,pec.classification_namePlease close the thread, if your issue is resolved.
    Cheers,
    VB

  • SCCM 2012 All Updates report sql query

    Need build sql query for report about all MS Updates like SCCM configuration manager view in window by path:
    \Software Library\Overview\Software Updates\All Software Updates.
    But I can't find fields that can show "product" (OS that use this patch) and size of each patch in SCCM and WSUS databases. Can anybody help me?

    To get file size I create query for files in package:
    SELECT distinct ui.Title, ui.InfoURL, ui.DatePosted,
    cf.FileName, cast(cast(cf.FileSize as real)/1024/1024 as decimal(10,2)) as SizeMb, uds.AssignmentName, uds.StartTime
    FROM CI_ContentFiles cf
    INNER JOIN v_UpdateContents uc  ON cf.Content_ID  = uc.Content_ID
    INNER JOIN v_UpdateInfo ui ON uc.CI_ID = ui.CI_ID 
    INNER JOIN vSMS_UpdateDeploymentSummary uds  ON ui.CI_ID = uds.CI_ID
    join CI_ContentPackages cp on cf.Content_ID=cp.Content_ID
    join CI_Contents co on co.Content_ID = cp.Content_ID
    Where PkgID='MKL00032'
    order by ui.InfoURL

  • Sql query to retrieve records in parent sibling relationship in a table

    I need help to write this Sql query on a table where it has the primary_id, parent_id, and sibling_id. A new row can be created with or without the parent_id and sibling_id. However most of the new rows are created from an existing row and the primary_id
    of the existing row is inserted to the parent_id of the new row. This can go on for many many rows such as (B's parent_id has A primary_id, A's sibling_id has B primary_id), (C's parent_id has B primary_id, B's sibling_id has C primary_id), (D's
    parent_id has C primary_id, C's sibling_id has D primary_id), What I want is when user pass on a primary_id on a row, the query will give me back all the related parent_id or sibling_id records. For example User pass the A's primary_id the query will
    give me back the Row B and Row C as a sibling rows or user pass the C's primary_id the query should give me back row B and Row A as parent rows. Thanks
    Kahlua

    Check http://social.technet.microsoft.com/wiki/contents/articles/21062.t-sql-hierarchical-table-sorting-with-a-parent-child-relation.aspx
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • SQL query with JSP and WML-parameters

    Hey,
    Could you help me?
    I'm trying to do the following. WML deck card 1 send parameter to same WML deck's card help. I try to read the parameter with JSP in card help by putting the parameter to SQL query, but it doesn't work. I can read the parameter with WML in card help. I can also print the value of the parameter with JSP if I generate WML with JSP.
    /*parameter sending from card 1 to card help*/
    out.println("<go href='#helpcard'>");
    out.println("<setvar name='valittukurssi' value='$(valittukurssi)'/>");
    /*parameter read with WML in card help */
    <p>Valitse kurssi.
    $valittukurssi</p>
    /'parameter read with JSP by generating WML with JSP*/
    out.println("<p>$valittukurssi</p>");
    /* SQL query with JSP */
    ResultSet uudettulokset = uusilause.executeQuery("select * from kurssi where lyhenne='$valittukurssi'");
    Thanks,
    Rampe

    You're problem is easy to fix. You're confusing WML variables with JSP variables. See below:
    >
    /*parameter sending from card 1 to card help*/
    out.println("<go href='#helpcard'>");
    out.println("<setvar name='valittukurssi'
    value='$(valittukurssi)'/>");
    Above you set a var that will work on the phone, not in JSP.
    /*parameter read with WML in card help */
    <p>Valitse kurssi.
    $valittukurssi</p>
    Yes the above does display the parameter, because it is a client side WML var, but you cannot use this variable in the JSP code (that's why your SWL fails).
    /'parameter read with JSP by generating WML with
    JSP*/
    out.println("<p>$valittukurssi</p>");Here's you're problem, the above line is EXACTLY the same as the one before it. When the container parses through this JSP code it translates the above line to:
    <p>$valittukurssi</p> on the WML page and the CLIENT uses it's local variable to display it.
    What you need and want is to have a variable that can be used in JSP code and output to your WML page. Here's how it's done:
    out.println("<go href='#helpcard'>");
    String some_name = "valittukurssi";
    out.println("<setvar name='"+some_name+"'
    value='$("+some_name+")'/>");
    //note that you may have to escape the ( and ) with a \
    //so we displayed the variable above into the WML page, now we can use it in the SQL query:
    /* SQL query with JSP */
    ResultSet uudettulokset =
    uusilause.executeQuery("select * from kurssi where
    lyhenne='"+some_name+"'");//the end of the command is: " ' " ) ;
    Frank Krul
    Got Node?

  • SQL query to find sqlnet.ora parameters

    Hi All,
    I am working 11g RAC /solaris 9
    I want have sql query to find values of sqlnet.ora parameters
    May be values of SQLNET.INBOUND_CONNECT_TIMEOUT
    SQLNET.SEND_TIMEOUT, SQLNET.RECV_TIMEOUT
    Thanks
    raj

    The sqlnet.ora file is the profile configuration file. It resides on the client machines and the database server.
    Profiles are stored and implemented using this file. The database server can be configured with access control parameters in the sqlnet.ora file.
    These parameters specify whether clients are allowed or denied access based on the protocol.
    The sqlnet.ora file enables you to do the following:
    Specify the client domain to append to unqualified names
    Prioritize naming methods
    Enable logging and tracing features
    Route connections through specific processes
    Configure parameters for external naming
    Configure Oracle Advanced Security
    Use protocol-specific parameters to restrict access to the database
    By default, the sqlnet.ora file is located in the ORACLE_HOME/network/admin directory. The sqlnet.ora file can also be stored in the directory specified by the TNS_ADMIN environment variable.
    You can not query on this file sqlnet.ora as tnsnames.ora file.
    Regards
    Mahir M. Quluzade

  • Report SQL query Help

    Hi,
    I am trying to call a procedure from a SQL report query. Please let me know if this is correct.
    SELECT gb.period_name,
    cc.segment1 uec,cc.segment2 dept, cc.segment3 other,
    cc.segment4 acct,cc.segment5 subacct, cc.segment6 activity,
    cc.segment7 cec, cc.segment8 subelement,cc.segment9 geo,
    cc.segment10 usind,cc.segment11 affiliate,cc.segment12 mpc,
    DECODE ( NVL (gb.begin_balance_dr_beq, 0)
    - NVL (gb.begin_balance_cr_beq, 0),
    0, ( NVL (gb.begin_balance_dr, 0)
    - NVL (gb.begin_balance_cr, 0)
    NULL, ( NVL (gb.begin_balance_dr, 0)
    - NVL (gb.begin_balance_cr, 0)
    NVL (gb.begin_balance_dr_beq, 0)
    - NVL (gb.begin_balance_cr_beq, 0)
    ) AS Begining_balance_functional,
    DECODE ( NVL (gb.period_net_dr_beq, 0)
    - NVL (gb.period_net_cr_beq, 0),
    0, ( NVL (gb.period_net_dr, 0)
    - NVL (gb.period_net_cr, 0)
    NULL, ( NVL (gb.period_net_dr, 0)
    - NVL (gb.period_net_cr, 0)
    NVL (gb.period_net_dr_beq, 0)
    - NVL (gb.period_net_cr_beq, 0)
    ) AS period_to_date_functional,
    (DECODE ( NVL (gb.begin_balance_dr_beq, 0)
    - NVL (gb.begin_balance_cr_beq, 0),
    0, ( NVL (gb.begin_balance_dr, 0)
    - NVL (gb.begin_balance_cr, 0)
    NULL, ( NVL (gb.begin_balance_dr, 0)
    - NVL (gb.begin_balance_cr, 0)
    NVL (gb.begin_balance_dr_beq, 0)
    - NVL (gb.begin_balance_cr_beq, 0)
    + (DECODE ( NVL (gb.period_net_dr_beq, 0)
    - NVL (gb.period_net_cr_beq, 0),
    0, ( NVL (gb.period_net_dr, 0)
    - NVL (gb.period_net_cr, 0)
    NULL, ( NVL (gb.period_net_dr, 0)
    - NVL (gb.period_net_cr, 0)
    NVL (gb.period_net_dr_beq, 0)
    - NVL (gb.period_net_cr_beq, 0)
    ) AS ending_balance_functional,
    NVL (gb.begin_balance_dr, 0)
    - NVL (gb.begin_balance_cr, 0) AS begining_balance_entered,
    NVL (gb.period_net_dr, 0)
    - NVL (gb.period_net_cr, 0) AS period_to_date_entered,
    ( NVL (gb.begin_balance_dr, 0)
    - NVL (gb.begin_balance_cr, 0)
    + (NVL (gb.period_net_dr, 0) - NVL (gb.period_net_cr, 0)
    ) AS ending_balance_entered,
    gb.currency_code,gb.period_year, gb.period_num,
    apps.afl_gl_acct.get_value_description('ALCOA UEC',cc.segment1) UEC_Description, apps.afl_gl_acct.get_value_description('ALCOA Cost Center',cc.segment2) Cost_center_Description,
    apps.afl_gl_acct.get_value_description('ALCOA Other',cc.segment3) Other_Description,
    apps.afl_gl_acct.get_value_description('ALCOA Account',cc.segment4) Account_Description,
    apps.afl_gl_acct.get_value_description('ALCOA SubAccount',cc.segment5) SubAccount_Description,
    apps.afl_gl_acct.get_value_description('ALCOA Activity',cc.segment6) Activity_Description,
    apps.afl_gl_acct.get_value_description('ALCOA CEC',cc.segment7) CEC_Description,
    apps.afl_gl_acct.get_value_description('ALCOA SubElement',cc.segment8) SubElement_Description,
    apps.afl_gl_acct.get_value_description('ALCOA GEO',cc.segment9) GEO_Description,
    apps.afl_gl_acct.get_value_description('ALCOA US Ind',cc.segment10) US_Ind_Description,
    apps.afl_gl_acct.get_value_description('ALCOA Affiliate',cc.segment11) Affil_Description,
    afl_gl_acct.get_value_description('ALCOA MPC',cc.segment12) MPC_Description
    FROM GL.GL_BALANCES GB, GL.GL_CODE_COMBINATIONS CC,
    GL.GL_Budget_Versions GBV, GL.GL_SETS_OF_BOOKS GSB
    WHERE GB.CODE_COMBINATION_ID = CC.CODE_COMBINATION_ID
    -- And CC.SEGMENT1 = (se
    And GB.BUDGET_VERSION_ID = GBV.BUDGET_VERSION_ID (+)
    And GSB.SET_OF_BOOKS_ID = GB.SET_OF_BOOKS_ID
    and decode(gb.TRANSLATED_FLAG,'Y','Translated','Entered') =:p_currency_type
    AND cc.segment1 =:p_uec
    AND GSB.NAME = :p_sob_name
    AND gb.PERIOD_NAME= :p_period
    AND cc.segment2= nvl(:p_dept,cc.segment2)
    AND cc.segment3=nvl(:p_other,cc.segment3)
    AND cc.segment4= nvl(:p_acct,cc.segment4)
    AND cc.segment5= nvl(:p_subacct,cc.segment5)
    AND cc.segment6 = nvl(:p_activity,cc.segment6)
    AND cc.segment7 = nvl(:p_cec,cc.segment7)
    and cc.segment8= nvl(:p_subelement,cc.segment8)
    and cc.segment9= nvl(:p_geo,cc.segment9)
    and cc.segment10=nvl(:p_usind,cc.segment10)
    and cc.segment11=nvl(:p_affil,cc.segment11)
    and cc.segment12=nvl(:p_mpc,cc.segment12)
    AND gb.ACTUAL_FLAG = 'A'
    AND gb.CURRENCY_CODE = :p_currency;
    I am not completely sure of the syntax.
    Regards,
    JA

    Please let me know if this is correct.Does it compile? Does it run? Does it return the correct result.
    Please bear in mind we do not have access to your data models so we cannot run it. Nor do we know your business requirements so we cannot assess whether it implements them correctly. And it is way too big a hunk o' code for us to go through it manually.
    As a rule of thumb it is better to build a small query and get that working correctly before adding tables to it rather than building an incomprehensibly large monolith.
    Cheers, APC
    Blog : http://radiofreetooting.blogspot.com/

  • SQL query not retrieving special characters in like O', M÷ and û

    Hi,
    I have a sql script to query database. The output is a string. When I execute this script through a Korn shell script to send the query result to a .csv file, it is showing some characters of the output as below.
    The characters O’ is displayed as ?
    The characters M÷ is displayed as ?
    The characters û is displayed as u
    I am able to retrieve the data as it is while running the script through SQL * Plus and spooling the output to a .csv file.
    If anybody is having solutions for this please reply.
    Thanks in advance for your kind help
    Regards,
    Sreesha
    Edited by: user530278 on Oct 18, 2008 2:56 PM

    user530278 wrote:
    Hi,
    I have a sql script to query database. The output is a string. When I execute this script through a Korn shell script to send the query result to a .csv file, it is showing some charcters of the output as below.
    The characters O’ is displayed as ?
    The characters M÷ is displayed as ?
    The characters û is displayed as uThis sounds like an NLS client setting issue.
    Note that there are scenarios where the data is "incorrectly" stored in the database but can be retrieved "successfully" from some clients. This is the case if you specify the same character set at your client as you have as database character set and this client character set setting is wrong, which means you ought to have specified a different client character set than you have in the database.
    Specifying the same character set on client and server prevents any conversion from taking place, so as long as the database can store the data (e.g. multi-byte characters won't be stored correctly in single-byte character set database no matter what you do) it will be stored "as is". If you now retrieve the data using the same setting, it looks correct, but if you use a client with a different character set setting that requires conversion the data will be mangled.
    The database character set can be identified using the dictionary view NLS_DATABASE_PARAMETERS, parameter "NLS_CHARACTERSET".
    The client character set can be identified by issuing the following at the SQL*Plus prompt:
    SQL> @[%NLS_LANG%]You'll get a message similar to:
    "Unable to open file [AMERICAN_AMERICA.WE8MSWIN1252]"
    The string after the dot represents the client character set.
    If you get this:
    Unable to open file "[%NLS_LANG%]"
    then the NLS_LANG client setting is undefined.
    Please follow this very useful link regarding client NLS issues and how to resolve them, in particular to determine what is your correct client NLS_LANG setting:
    http://www.oracle.com/technology/tech/globalization/htdocs/nls_lang%20faq.htm
    I am able to retreive the data as it is while running the script through SQL * Plus and spooling the output to a .csv file.You mean that when using SQL*Plus interactively the data is shown/spooled correctly, whereas if you run a script non-interactively then the data is mangled?
    Note that if you e.g. use "cron" to schedule/execute your script that you need to take care of the Oracle specific environment variables yourself because no logon scripts are executed when cron forks the process to run. May be you need to define the NLS_LANG variable explicitly or call/source the corresponding script to define your default Oracle environment that includes the NLS_LANG setting.
    It probably depends on your environment, operating system, etc. and how you set the Oracle specific settings, e.g. environment variables under Unix, registry settings under Windows etc.
    Use the above mentioned check regarding NLS_LANG setting in the different cases that you encounter to get started.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • SQL query to return list of table names.

    Hi all,
    I'm looking for a query that will return a list of the table names that exist in my Microsoft Access database.
    Any ideas?

    http://forum.java.sun.com/thread.jsp?forum=31&thread=348287
    http://java.sun.com/j2se/1.4.2/docs/api/java/sql/DatabaseMetaData.html
    I would suggest you strat to use the search at the upper right.
    You can leave it blank and the advanced search will appear.
    You can then select the specific areas you want to search.

Maybe you are looking for