Get SQL Query from the Region Source

Hi,
The below query gives me the region source code,
SELECT region_source into p_sql_stmt
FROM apex_application_page_regions
WHERE region_id = 01129836282 AND
page_id = 54 AND
application_id = 215;
Initially I use to have only the SQL region source code as mentioned below , So using the above query i use to pass the sql code to p_sql_stmt
SELECT PROJECT_ID,EMPLOYEE_ID,EFFECTIVE_DATE FROM AR_V_ADDRESS_HISTORY WHERE PROJECT_ID = :P51_PROJECT_ID
Now the changes what i did in the page region source is i am using a PLSQL return query which is mentioned below
declare
qry varchar2(32000);
begin
qry := ' SELECT PROJECT_ID,EMPLOYEE_ID,EFFECTIVE_DATE';
for c1 in ( SELECT * FROM AR_ADDRESS_TYPE)
loop
qry := qry ||
' , GET_ADDRESS_LINE_1(PROJECT_ID,EMPLOYEE_ID,' || c1.address_type_id || ' ,TO_DATE(EFFECTIVE_DATE)) "' || c1.name ||'_ADDRESS_TYPE_1"';
qry := qry ||
' , GET_ADDRESS_LINE_1(PROJECT_ID,EMPLOYEE_ID,' || c1.address_type_id || ' ,TO_DATE(EFFECTIVE_DATE)) "' || c1.name ||'_ADDRESS_TYPE_2"';
end loop;
qry := qry || ' FROM AR_V_ADDRESS_HISTORY
WHERE
PROJECT_ID = :P51_PROJECT_ID ';
return(qry);
end;
If i execute the above code in the with dbms_output.put_line in the SQL developer or TOAD it prints the sql query which i wanted, Since i am using this in a apex page i need to get the SQL code from the apex page.
Can any one please suggest me how to get this sql code using the above plsql code.
Please suggest me in this issue
Thanks
Sudhir

One way to get the sql statement is
Create a global variable in the package spec where your function returns sql statement and assign the final sql statement to the package spec variable before the return.
Write a wrapper function to return the stored sql statement value.
Example code below:
create or replace package xx_test_pkg as
g_sql_stmt CLOB;
function get_sql() return clob;
function get_stored_val() return clob;
end;
create or replace body package xx_test_pkg as
function get_sql return clob ..
v_sqlstmt clob;
begin
v_sqlstmt := 'select * from emp';
-- assign to global variable before returning the value
g_sql_stmt := v_sqlstmt;
return v_sqlstmt;
end;
function get_stored_val() ....
begin
return g_sql_stmnt;
end;
end;

Similar Messages

  • 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

  • How to execute SQL Query from the Crystal report X1

    Dear All,
    I am using crystal report X1. In my application am creating run time MS Access tables and giving table name at run time based on my requirement . From these tables I want to fetch data based on some condition and to display using crystal report X1. I have never used the SQL Queries in the Crystal reports. Please help me out.
    Thanks and Regards,
    Rahaneef T

    Please note;
    This forum is dedicated to all other development-related questions which are not directly addressed by other forums. This includes Business Objects SDKs, products, or technologies which do not fall under BusinessObjects Enterprise, BusinessObjects Edge, Crystal Reports Server, or Crystal Reports (for example Desktop Intelligence SDK, Universe Designer SDK, Portal Integration Kits, Java User Function Libraries, and other third party technologies or development languages).
    This looks more like a Crystal Reports design issue?
    Ludek

  • Is there's a way to get the Region Source of a Page?

    Is there's a way (command, function...) to get the Region Source of a Page???? I woud like to assign a variable a query (but the query of the Region Source).

    Hi,
    have a look at the APEX dictionary views. The one you are looking for is APEX_APPLICATION_PAGE_REGIONS.
    In the Builder you can find all of them at "Application Builder" -> Tasks (Sidebar) -> Application Express Views.
    Regards
    Patrick
    Member of the APEX development team
    My Blog: http://www.inside-oracle-apex.com
    APEX Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • Using sql bulk copy throwing exception -The given value of type String from the data source cannot be converted to type int of the specified target column

    Hi All,
    I am reading notepads files and inserting data in sql tables from the notepad-
    while performing sql bulk copy on this line it throws exception - "bulkcopy.WriteToServer(dt); -"data type related(mentioned in subject )".
    Please go through my  logic and tell me what to change to avoid this error -
    public void Main()
    Dts.TaskResult = (int)ScriptResults.Success;
    string[] filePaths = Directory.GetFiles(@"C:\Users\jainruc\Desktop\Sudhanshu\master_db\Archive\test\content_insert\");
    for (int k = 0; k < filePaths.Length; k++)
    string[] lines = System.IO.File.ReadAllLines(filePaths[k]);
    //table name needs to extract after = sign
    string[] pathArr = filePaths[0].Split('\\');
    string tablename = pathArr[9].Split('.')[0];
    DataTable dt = new DataTable(tablename);
    |
    string[] arrColumns = lines[1].Split(new char[] { '|' });
    foreach (string col in arrColumns)
    dt.Columns.Add(col);
    for (int i = 2; i < lines.Length; i++)
    string[] columnsvals = lines[i].Split(new char[] { '|' });
    DataRow dr = dt.NewRow();
    for (int j = 0; j < columnsvals.Length; j++)
    //Console.Write(columnsvals[j]);
    if (string.IsNullOrEmpty(columnsvals[j]))
    dr[j] = DBNull.Value;
    else
    dr[j] = columnsvals[j];
    dt.Rows.Add(dr);
    SqlConnection conn = new SqlConnection();
    conn.ConnectionString = "Data Source=UI3DATS009X;" + "Initial Catalog=BHI_CSP_DB;" + "User Id=sa;" + "Password=3pp$erv1ce$4";
    conn.Open();
    SqlBulkCopy bulkcopy = new SqlBulkCopy(conn);
    bulkcopy.DestinationTableName = dt.TableName;
    bulkcopy.WriteToServer(dt);
    conn.Close();
    Issue 1:-
    I am reading notepad: getting all column and values in my data table now while inserting for date and time or integer field i need to do explicit conversion how to write for specific column before bulkcopy.WriteToServer(dt);
    Issue 2:- Notepad does not contains all columns nor in specific sequence in that case i can add few column ehich i am doing now but the issue is now data table will add my columns + notepad columns and while inserting how to assign in perticular colums?
    sudhanshu sharma Do good and cast it into river :)

    Hi,
    I think you'll have to do an explicit column mapping if they are not in exact sequence in both source and destination.
    Have a look at this link:
    https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopycolumnmapping(v=vs.110).aspx
    Good Luck!
    Kaur.
    Please mark as answer if this resolves your issue.

  • How can I get a query in the search field to open in a new tab or new window from the current window?

    How can I get a query in the search field to open in a new tab or new window from the current window?

    If you are searching via the Search Bar on the Navigation Toolbar, this preference can be changed to have searches there open in a Tab.
    Type '''about:config''' in the Address Bar and hit Enter. Then answer "I'll be careful". Type this pref in the Search at the top.
    '''browser.search.openintab''' = double-click to toggle to '''true'''

  • SQL Query (updateable report) Region - Conditionally Hide and Set Values

    SQL Query (updateable report) Region - Conditionally Hide and Set Values
    Outline of requirement :-
    Master / Detail page with Detail updated on same page using SQL Query (updateable report).
    The detail region has the following source
    SELECT item_id,
           contract_id,
           CASE WHEN hardware_id IS NOT NULL THEN
                   'HA'
                WHEN backup_dev_id IS NOT NULL THEN
                   'BD'
                WHEN hardware_os_id IS NOT NULL THEN
                   'HS'
           END item_type,
           hardware_id,
           backup_dev_id,
           hardware_os_id
    FROM   "#OWNER#".support_items
    WHERE  contract_id = :P26_CONTRACT_IDThe table support_items implements arced relationships and has the following columns
    CREATE TABLE SUPPORT_ITEMS
      ITEM_ID         NUMBER                        NOT NULL,
      CONTRACT_ID     NUMBER                        NOT NULL,
      HARDWARE_ID     NUMBER,
      BACKUP_DEV_ID   NUMBER,
      HARDWARE_OS_ID  NUMBER
    )A check type constaint on support_items ensures that only one of the fk's is present.
          (    hardware_id    IS NOT NULL
           AND backup_dev_id  IS NULL
           AND hardware_os_id IS NULL
    OR    (    hardware_id    IS NULL
           AND backup_dev_id  IS NOT NULL
           AND hardware_os_id IS NULL
    OR    (    hardware_id    IS NULL
           AND backup_dev_id  IS NULL
           AND hardware_os_id IS NOT NULL
          )    Hardware_Id is a FK to Hardware_Assets
    Backup_dev_id is a FK to Backup_Devices
    Hardware_os_id is a FK to Hardware_op_systems
    The Tabular Form Element based on item_type column of SQL query is Displayed As Select List (based on LOV) referencing a named list of values which have the following properties
    Display Value     Return Value
    Hardware Asset    HA
    Backup Device     BD
    Computer System   HSThe Tabular Form Elements for the report attributes for hardware_id, backup_dev_id and hardware_os_id are all Displayed As Select List (Based on LOV).
    What I want to do is only display the Select List for the FK depending on the value of the Select List on Item Type, e.g.
    Item_Type is 'HA' then display Select List for hardware_id, do not display and set to NULL the Select Lists for backup_dev_id and hardware_os_id.
    Item_Type is 'BB' then display Select List for backup_dev_id, do not display and set to NULL the Select Lists for hardware_id and hardware_os_id.
    Item_Type is 'HS' then display Select List for hardware_os_id, do not display and set to NULL the Select Lists backup_dev_id and hardware_id.
    There are properties on elements to conditionally display it but how do we reference the values of the SQL query Updateable region? they are not given a page item name?
    Also on the Tabular For Elements there is an Edit tick against a report item - however when you go to the Column Attributes there is not a property with which you can control the Edit setting.
    What's the best way of implementing this requirement in APEX 3.1?
    Thanks.

    >
    Welcome to the forum: please read the FAQ and forum sticky threads (if you haven't done so already), and update your profile with a real handle instead of "user13515136".
    When you have a problem you'll get a faster, more effective response by including as much relevant information as possible upfront. This should include:
    <li>Full APEX version
    <li>Full DB/version/edition/host OS
    <li>Web server architecture (EPG, OHS or APEX listener/host OS)
    <li>Browser(s) and version(s) used
    <li>Theme
    <li>Template(s)
    <li>Region/item type(s) (making particular distinction as to whether a "report" is a standard report, an interactive report, or in fact an "updateable report" (i.e. a tabular form)
    With APEX we're also fortunate to have a great resource in apex.oracle.com where we can reproduce and share problems. Reproducing things there is the best way to troubleshoot most issues, especially those relating to layout and visual formatting. If you expect a detailed answer then it's appropriate for you to take on a significant part of the effort by getting as far as possible with an example of the problem on apex.oracle.com before asking for assistance with specific issues, which we can then see at first hand.
    I have a multi-row region that displays values and allows entries in a number of fields.Provide exact details of how this has been implemented. (An example on apex.oracle.com is always a good way to do this.)
    I should like the fields to be conditional in that they do not permit entry, but still display, if certain conditions apply (e.g. older rows greyed out). Can this be done? Almost anything can be done, often in multiple ways. Which are appropriate may be dependent on a particular implementation, the skills available to implement it, and the effort you're willing to expend on it. Hence it's necessary to provide full details of what you've done so far...

  • How to transport SQL Query from SQVI Tcode?

    Dear Friends,
    Can any one tell me how to transport SQL Query from <b>SQVI</b> Tcode.
    Full Points will be rewarded.
    Thanks & Reagrds
    Ravi

    go to sqvi tool .....
    select u r query name ......in the menubar ....quickview....> additianal functions.......>generate program
    after doing generate program ....go to again same menu path as i have mentioned above [quickview....> additianal functions.......>display report name it will give the report name of the select query ..........copy the report name and give it abap editor[se38] u will get u r query program......with all authority checks.....
    in start of selection event of u r program u will find u r select query.
    reward points if helpful

  • Retrieve SQL Query from report without RAS.

    We have a fat client application which uses Crystal Reports.  We upgraded from the RDC/ActiveX viewer to the .Net SDK/.Net Viewer.  One feature that we miss is that we used to read the SQL Query that a report used and wrote it to our log file.  This helped with debugging and with troubleshooting problems in the field.
    Since we only deploy the freely distributable Crystal Reports model and I don't think that RAS falls into this category is there a way which we can read the SQL Query from a report?  If not, could you add this to a list of requested features for future versions.
    I understand why you removed the ability to set the SQL query, but simply reading it does add value.  Maybe it is difficult for you to return this before the report is run in which case giving us the ability to read the value after the report has been run would also be fine.
    Alternatively some sort of event that is fired each time a query is executed would also be helpful as this would allow Crystal Reports clients to monitor SQL from sub-reports.  You could even build a robust logging mechanism which could report additional information (i.e. number of rows returned, formula evaluations, or anything related to report execution).  All of this would make troubleshooting report issues easier for those of us who use Crystal Reports.

    Need to know what version of CR you are using?
    You can use InProc RAS, it comes with CR and is distributed with the runtime files.
    If you are using CR Basic or the version that comes with Visual Studio .NET then no this will not be added to that product line. It is basic functionality only. You will need to upgrade to a Developer version of Crystal reports to take advantage of the the RCAPI features as well as more general API's.
    There is logging for our DB drivers but the log files get very large. If you use ODBC then you have the option to turn on tracing also. Using RAS you don't need to turn on logging as you can get the SQL. This won't be added either.
    Thank you
    Don

  • BusinessObject 4.0 API to get SQL statement from webi or crystal report

    Hello,
    Need your help.... could you confirm whether BusinessObjects 4.0 provides any SDK, API or Web Service to get physical SQL statement from the webi or crystal reports file?
    If so, could you provide name of package, class and method?
    If I am not wrong, there is an SDK in v3.0 that allows to extract the SQL. But I am reading a lot on these forums that lot of SDK classes and functions are deprecated / removed in v4.0.
    Thanks for your help.
    Omer

    For Crystal Reports in BI 4.0 to retrieve the SQL query you can use Report Application Server SDK. Here is a code snippet that retrieves the SQL statement.
    //oInfoObjectReport is of type IInfoObject corresponding to the crystal report.
    ReportClientDocument reportClientDoc = reportAppFactory.openDocument(oInfoObjectReport, 0, Locale.ENGLISH);
            //for all crystal reports
            GroupPath grpPath = new GroupPath();
            //get CR SQL query string
            String reportSQL=reportClientDoc.getRowsetController().getSQLStatement(grpPath,null);
            System.out.println("report SQL String: "+reportSQL);
            //for report whose datasource is command object:
            Tables tables = reportClientDoc.getDatabaseController().getDatabase().getTables();
            for (int i = 0; i < tables.size(); i++)
             ITable table = tables.getTable(i);
             ICommandTable ic= (ICommandTable) table;
             //Command can be obtained from the report using getCommandObject() method
             //get CR SQL query string
             String SQLText=ic.getCommandText();
             System.out.println("SQLText_"+i+": "+SQLText);
    Here are useful links for BI 4.0
    [RAS API Specification|http://help.sap.com/businessobject/product_guides/boexir4/en/xi4_rasjava_apiRef_en.zip]
    [RAS Developer Guide|http://help.sap.com/businessobject/product_guides/boexir4/en/xi4_rasjava_dg_en.zip]

  • How to get multiple values from the list

    I've a list of an item which I queried it from the database. I also created a button that will takes a selected items from the list when it was clicked. I used javabean to get the data from database.
    <%     // clicked on Select District Button
    Vector vselectedDistrict = new Vector();
    Vector vdistrictID = new Vector();
    String tmpSelectDistrict = "";
    tmpSelectDistrict = request.getParameter("bSelectDistrict");
    if(tmpSelectDistrict != null)
         // get multiple values from the list
         String[] selectedDistrict = request.getParameterValues("usrTDistrict");
         vselectedDistrict.clear();
         vdistrictID.clear();
         if((selectedDistrict != null) && (selectedDistrict.length != 0))
                             for(int i=0;i<selectedDistrict.length;i++)
                   vselectedDistrict.addElement(selectedDistrict);           
              vdistrictID = dbaseInfo.getcurrentDistrictID(nstate,vselectedDistrict);
              for(int i=0;i<vdistrictID.size();i++)
                   out.println("district = " + selectedDistrict[i]);                         out.println("district ID= " + vdistrictID.get(i).toString());
    %>
    // get vdistrict from the database here......
    <select name="usrTDistrict" size="5" multiple>
    <%     for(int i = 0; i< vdistrict.size(); i++)
    %>
         <option value="<%=vdistrict.get(i).toString()%>"><%=vdistrict.get(i).toString()%></option>
    <%
    %>          
    </select>
    <input type="submit" name="bSelectDistrict" value="Select District">
    Lets say the item that i selected from the list is 'Xplace' and I clicked on the Select District button,
    what I got is this error message:
    org.apache.jasper.JasperException: Unable to convert string 'Xplace' to class java.util.Vector for attribute usrTDistrict: java.lang.IllegalArgumentException: Property Editor not registered with the PropertyEditorManager
    So where is going wrong and what the message means?. Any help very much appreciated. Thanks

    These are just guesses that might hopefully steer you in directions you haven't looked in yet.
    I presume you used triangle brackets (< >) to avoid having the Jive Forum think it was the "italics" tag?
    Are you certain this: dbaseInfo.getcurrentDistrictID(nstate,vselectedDistrict);
    expects a Vector as its second parameter? And returns a Vector?
    I don't believe you've shown how you use the javabean, or its code? Perhaps it should be rewritten to accept an array of strings instead of a Vector?

  • See sql query from crystal report without crystal report

    see sql query from crystal report without crystal report 

    Hi,
    Depends on datasource type but you could have a look at ODBC trace or if you have access to the SQL Server you could use profiler to monitor the session.
    Regards,
    Craig
    And this will only be of use if you know which Server/Insstance/Database the Report is connecting to...
    Please click "Mark As Answer" if my post helped. Tony C.

  • How do I get routing data from the Map App (powered by TomTom) so I can display the point-to-point annotations (turn-by-turn navigation) without leaving my own application.

    I have a tableView displaying a list of contacts from a Cloud Database.  After selecting a contact, I push to a programmatically created MKMapView.  Then I display the initial region (the view) that includes the users current location (starting point) and their selected destination (end point).
    Now I want to display annotations (as described in the Location Awareness Programming Guide) that displays polylines which will represent the turn-by-turn navigation IN MY OWN APPLICATION, and not in the Map App currently used in IOS6. 
    Due to licensing and its becoming depricated in IOS 6, I do not want to get routing data from the Google Maps API.  How do I get routing data from the IOS 6 Map App (powered by TomTom) so I can display the point-to-point annotations (turn-by-turn navigation) without leaving my own application?
    I checked out Stack Overflow and other forums which basically left me with the impression that this is not possible. I also checked out the TomTom iPhone Mobile SDK User Guide from the TomTom Developer Portal and am still confused.  It must be possible to retrieve routes, since the Map App can display turn-by-turn directions.  How can I retrieve turn-by-turn data that I may display as a route within my own application?

    Thanks Michael. Apologies for the slow reply I was away for a bit (holiday blitz at work and visiting family madness etc.etc.) back now, I set both options you requested to "never " and retried the CMS software with no change. 
    I do have progress of a sort though, as a test I took a separate test PC and put a clean install of Win7 on and loaded up the CMS software (it worked perfectly) and then took the version of ole32.dll off that machine and put it onto the computer I had built
    for her (using Linux) and...
    got a new error code. Darn I was so sure I had found a clever solution this time lol.
    Anyway now when the CMS fails it gives me a similar error but the offending module is "ntdll.dll" sooo... I tried taking the "working" version of ntdll.dll from the test box and moving it over (making sure to back up the existing ones
    first so I could put them back if needed) to her new PC and the PC would not boot. 
    It seems to want the original versions of a few Dynamic Link Libraries and if I could somehow give it those while not breaking Win7 it should theoretically work seeing as it no longer errors with ole32.dll. 
    ntdll.dll however seems necessary for Win7 to boot.
    So what I am wondering now is:
    Is there some way to have both versions of the DLL file in the system32 folder (bypassing the "cannot have two files with the exact same name in the same folder" thing) or rename the original DLL's something else and somehow make the CMS look for
    the new named versions so the system has the updated DLL's it needs to boot/run and the CMS has the old ones it wants to run or is there someway to have a self contained install of the CMS, say on a USB flash drive and give it it's own E:/windows/system32/needed
    dll's  path to the files it needs? 
    Willing to try any other options or settings you may have come up with as well.
    Thanks again for your reply and my apologies for not answering sooner.

  • Query from the data abse  and pass values to a pdf form

    query from the data abse and pass values to a pdf form
    Hello
    Hello i have this html report that i have written to output a
    report.
    now, i am assigned to pass the same fields to a pdf form so
    the fields in the adaobe form can be populated or the term
    Pre-populate the form.
    can anyone help me get started.
    first i would like to know if it can be done.
    second, what do i need to get started (tools )
    third how do i do this.
    i am really lost at this point.
    can anyone give me tips in how to approach this
    subject??

    It can be one using Adobe Acrobat Designer which is packaged
    with Acrobat
    Professional Pro 7. It uses all XML to create and populate
    forms.
    If you had the time, you can also create <cfdocument
    type="pdf"> to have
    them ready and just pass the info to it so it autogenerates
    the PDF on the
    fly.

  • How to query from the xml table a single, specified element.

    I'm quite new in Xml Db. Pleas, can anybody tell me how to query from the xml table below a single element (i.e. the element 'rapportoparentela = NIPOTE' related to the element 'codicefiscale = CRRVNC76R52G337R', or the element 'rapportoparentela = FIGLIO' related to the element 'codicefiscale = CRRRNT51L23G337Q')?
    - <dati xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <codiceinterno />
    <codicefiscaleassistito>CRRMNL81R31G337H</codicefiscaleassistito>
    - <famigliare>
    <codicefiscale>CRRVNC76R52G337R</codicefiscale>
    <rapportoparentela>NIPOTE</rapportoparentela>
    </famigliare>
    - <famigliare>
    <codicefiscale>CRRRNT51L23G337Q</codicefiscale>
    <rapportoparentela>FIGLIO</rapportoparentela>
    </famigliare>
    - <famigliare>
    <codicefiscale>CBRPRN15S65E080W</codicefiscale>
    <rapportoparentela>I.S.</rapportoparentela>
    </famigliare>
    - <famigliare>
    <codicefiscale>CRRMNL81R31G337H</codicefiscale>
    <rapportoparentela>NIPOTE</rapportoparentela>
    </famigliare>
    - <famigliare>
    <codicefiscale>BCCCML54C50I845G</codicefiscale>
    <rapportoparentela>NUORA</rapportoparentela>
    </famigliare>
    </dati>
    Using SELECT extractValue(value(t),'/rapportoparentela') into result FROM NF_XMLT X,
    TABLE ( xmlsequence (extract(value(X),'/dati/famigliare/rapportoparentela'))) t
    I get all the elements 'rapportoparentela' and I want to get only one specified.
    Regards.
    Piero

    Piero,
    you can add the condition "CRRVNC76R52G337R" to your xpath-expression like:
    SELECT extractValue(value(t),'/rapportoparentela')
    FROM NF_XMLT x
    ,TABLE ( xmlsequence (extract(value(X),'/dati/famigliare[rapportoparentela="CRRVNC76R52G337R"]'))) tto select only those famigliare-elements that have a child-element rapportoparentela with value "CRRVNC76R52G337R".
    When you stored your XML in an XMLType column in the table, i think the following queries are better:
    SELECT extractValue(x.your_XMLType_column,'/dati/famigliare/rapportoparentela')
    FROM NF_XMLT x
    WHERE extractValue(x.your_XMLType_column,'/dati/famigliare/codicefiscale')
    = 'CRRVNC76R52G337R'or
    SELECT extractValue(x.your_XMLType_column,'/dati/famigliare/rapportoparentela')
    FROM NF_XMLT x
    WHERE existsNode(x.your_XMLType_column,'/dati/famigliare[codicefiscale="CRRVNC76R52G337R"]')
    != 0

Maybe you are looking for

  • How can i find out what color is a certain pixel in a picture file?

    Do any of you know if there is some command that returns the color of a pixel in RGB format or something from a picture file?

  • Searching problems on new Macbook

    I bought a new Macbook last week and transferred all my files/data from previous model through crossover cable; worked flawlessly. Now I am having problems with searches both with Spotlight and in individual applications (worked fine on old model). T

  • The address in the URL-bar doesn't update after clicking some links. Why?

    Hello, first: thanks a lot for this great Browser! My Firefox-Version: 6.0.2 on Windows XP My Problem: Since a few weeks (I think since Version 6.x) I experience this problem. When I click on a link, normally the URL-bar gets updated and shows the ad

  • How to get out of fullscreen exclusive mode?

    I have a program that runs in full screen exclusive mode, I'd like the program to start up in windowed mode instead. I spent several hours trying to make it run in window mode, but I can't seem to figure it out :/ Here's the code:         if (graphic

  • WORK ITEMS

    How can we create the WORK ITEMS of work flow?? My requirement is that when a sales order is created I need to send a<b> work item</b> to the authorised person with two options,<b>Approve</b> and <b>Reject</b>. When he approves a method has to be cre