Create record variable that refers dynamic query assigned to a ref cursor?

Hi ,
Just explaining what I am trying to achieve:
1) i have a hr.departments table that was loaded in hr schema on 1st oct 2012 with 4 columns(department_id, department_name, manager_id, location_id)
2) now I have a new schema by my name 'rahul' and I have loaded departments table but now an additional column has come into picture,ie created_date, this table got loaded on 1st-Nov-2012
3) Now going forward my columns could be dropped from the departments table (it can be a case), for example might be my departments table in my schema 'rahul' one day could comprise of only 3 columns(department_id,department_name,manager_id)
4) Now in the next step, I have managed to extract common column names(in a single line where columns are delimited using a comma) from both the tables(hr.departments and rahul.departments) which are (department_id, department_name, manager_id, location_id) using all_tab_cols table and I have written a function for it which i will be pasting below.
5) now going forward, using the above column names line with column names delimited using comma, I have used a ref cursor and assigned a query to it using the line of columns that I have extracted from the above point
6) Now I want to create a record variable which refers to my ref cursor, something like we do when we create a record variable by reffering to an explicit cursor defination that we give in the declaration block.
PS:
1) I have been out of touch with plsql for a long time so I have lost a lot of mmeory regarding plsql.
2) basically I need to compare data in hr.departments table with rahul.departments table for only columns that are common to both the tables, rest new or discarded columns information will go in one of the log tables that I have created(this is done already)
Please help me, I did try searching on google for the same but it really confused me very badly, any kind of help is appreciated, please find my code below:
Regards
Rahul
Code :
===================================================================================================
create or replace procedure p_compare_data(fp_old_table_name in varchar2, fp_new_table_name in varchar2)
is
type ref_cursor_old_table is ref cursor;
v_ref_cursor_old_table ref_cursor_old_table;
--record_v_ref_cursor_old_table v_ref_cursor_old_table;
--record_ref_cursor_old_table v_ref_cursor_old_table%ROWTYPE;
Lv_all_column_names varchar2(2000);
function f_fetch_common_column_names(fp_old_table_name in varchar2, fp_new_table_name in varchar2)
return varchar2
is
          Lv_all_column_names varchar2(2000);
begin
          execute immediate 'select ltrim(all_column_names,'','') all_column_names_in_line from (select * from (select sys_connect_by_path(hr_e_column_name,'','') all_column_names from (select hr_e_column_name, rownum curr, rownum - 1 prev from (select hr_e.* , rahul_e.* , case when (hr_e_column_name = rahul_e_column_name) then 1 when (rahul_e_column_name is NULL) then 2 when (hr_e_column_name is NULL) then 3 end decision from (select column_name hr_e_column_name from all_tab_cols where owner ='''||substr(fp_old_table_name,1,instr(fp_old_table_name,'.',1,1)-1)||''' and table_name = '''||substr(fp_old_table_name,instr(fp_old_table_name,'.',1,1)+1)||''') hr_e full outer join (select column_name rahul_e_column_name from all_tab_cols where owner = '''||substr(fp_new_table_name,1,instr(fp_new_table_name,'.',1,1)-1)||''' and table_name = '''||substr(fp_new_table_name,instr(fp_new_table_name,'.',1,1)+1)||''') rahul_e on hr_e.hr_e_column_name = rahul_e.rahul_e_column_name) decision_table where decision = 1) a start with a.curr = 1 connect by prior curr = prev) b order by length(b.all_column_names) desc) all_column_names_in_line where rownum = 1' into Lv_all_column_names;
          return (Lv_all_column_names);
end;
begin
     Lv_all_column_names := f_fetch_common_column_names(fp_old_table_name, fp_new_table_name);
     --dbms_output.put_line(Lv_all_column_names);
     open v_ref_cursor_old_table for ('select '||Lv_all_column_names||' from '||fp_old_table_name);
end;
=====================================================================================================

>
6) Now I want to create a record variable which refers to my ref cursor, something like we do when we create a record variable by reffering to an explicit cursor defination that we give in the declaration block.
>
This thread is basically nothing more than a continuation of your original thread except now you are finally explaining what you are really trying to do.
Re: passing table name to a procedure and then need to open a cursor ..
In that original thread you said you found the solution
>
Well Mate thanks for your suggestion but I got it working through ref cusror, thanks for your time.
>
So I ask you to post your 'solution' and when you finally did it was clear that you hadn't solved anything at all. Your solution used a ref cursor all right but the code relied on a record ('record_employees') that was based on a table name ('employees') that was declared within the procedure. There isn't much point in passing in a table name if you have to hard-code the table name in the procedure.
create or replace procedure p_ref_cursor(fp_old_table in varchar2)
is
type ref_cursor is REF CURSOR;
v_ref_cursor ref_cursor;
record_employees hr.employees%ROWTYPE;
begin
open v_ref_cursor for 'select * from '||fp_old_table;
loop
fetch v_ref_cursor into record_employees;
exit when v_ref_cursor%NOTFOUND;
dbms_output.put_line(record_employees.employee_id);
end loop;
end;Then sb92075 ask you the question that illustrates what I just said
>
what happens when you pass in "HR.DEPARTMENTS" ; besides throwing errors?
>
And you blew him off with this
>
Mate, departments never came in my context, in my prior message I explained what I was trying to achieve ... so I dont know what problem you are understanding reading my posts.
>
And now here you are asking how to get this to work for the departments table.
It is very difficult to help someone that won't tell us what it is they are really trying to do so we can try to suggest some better ways of doing it. Hopefully, in the future, you wil start by explaining your problems instead of focusing on the solution you think you should use.
Back to the issue -
The first thing you should do is finish defining the requirements. Assuming the above actually works to identify columns that have different data what are you going to do with that information?
1. Do you need to save that different data from TABLE1 somewhere?
2. If you don't save it how will anyone look at it to decide which table has the correct data?
3. If you do save it how will you save it 'generically' since other tables will have different columns and datatypes?
4. What about the data from the same record in TABLE2; do you need to save that data somewhere?
5. Will these two tables have primary keys? Are they on the same columns in each table? If not what if TABLE1 has one record but there are TWO records in TABLE2 that are identical. Is that a match? Or is that a problem because TABLE2 has an extra record even though the record is identical?
In short detecting the differences is just one small part of the entire problem. You also need to save those differences somewhere so someone can examine the data and decide what action to take. That is the more difficult part of trying to implement a 'generic' solution.
But now that we know what you are really trying to do take a read through this thread from 6 years ago. It has three different ways to pass a query to a procedure and get different output. You may want to save a copy of the thread since it has some very advanced techniques in it.
How to pipeline a function with a dynamic number of columns?
See ascheffer's reply Posted: May 9, 2006 4:53 AM for using data cartridge functionality with a pipelined function.
See Kamal's reply Posted: May 10, 2006 4:49 AM - it shows how to get XML output.
See BluShadow's reply Posted: Mar 27, 2009 1:50 AM - for using dynamic sql

Similar Messages

  • How to create custom BOL object for dynamic query in CRM 7.0

    Hi,
    Could anyone please explain me with steps that how to create the custom BOL object for dynamic query in CRM 7.0, I did it in previous version but its throwing exception when i try to create the object of my dynamic query class. I just defined the entry of my in crmv_obj_btil to create the dynamic query BOL object. do i need to do any other thing also to make it work?
    Regards,
    Kamesh Bathla
    Edited by: Kamesh Bathla on Jul 6, 2009 5:12 PM

    Hi Justin,
    First of thanks for your reply, and coming to my requirement, I need to report the list of items which are there in the dynamic select statement what am getting from the DB. The select statement number of columns may vary in my example for different countries the select item columns count is different. For US its '15', for UK it may be 10 ...like so, and some of the column value might be a combination or calculation part of other table columns (The select query contains more than one table in the from clause).
    In order to execute the dynamic select statement and return the result i choose to write a function which will parse the cursor for dynamic query and then iterate the values and construct a Type Object and append it to the pipe row.
    Am relatively very new for these sort of things, welcome in case of any suggestions to make it simple (Instead of the function what i thought to work with) also a sample narrating the new procedure will be appreciated.
    Thanks in Advance,
    mallikj2.

  • Is it possible to create a variable that tells you which slides the user has visited?

    Hi there.
    I'm working on a project where I want a slide to show a continue button and hide 2 textboxes, but ONLY when the user has already visited 2 other slides. I can only find variables that tell you the slide the user previously visited.
    Is it possible to set up a variable that does this?
    I want to create the following advanced action:
    If the user has visited slides 62 AND 87, show image_536 and hide text_caption_243 and text_caption_242
    I don't want the action to happen if only 1 of the 2 slides have been visited - it has to happen when both have been visited.
    Hope that makes sense.
    I'm using Captivate 7.
    Thanks.

    You will need two variables, it can be booleans. I'll label them v_one and v_two with a default value of 0
    Since I don't know how the slides are formatted, do you use a Next button or are all the slide frames visited? You'll need to have an event on those two slides to trigger an action:
    Assign v_one with 1     on slide 62
    And a similar action on the other slide to toggle v_two (do not use the toggle command, if the user visits a slide twice, it would be toggled back to 0).
    You didn't specify where those text containers have to be (please, label your objects and slides)? But you'll need conditional advanced action triggered by another event somewhere:
       IF v_one is equal to 1   AND
           v_two is equal to 1
      Show text1
      Show text2

  • Inserting Title variable that refers to topic other than where variable resides

    Still using RH9, but I think RH10 is going into our upcoming budget. I understand the Title variable in the Fields and Variables dialog refers to the title of the topic in which you are placing the variable. However, I would like to use a topic title reference in another topic, because it is likely the title will change and I only want to change it in one place and have it reflected automatically.
    Here are two inadequate solutions I would reject:
    Dragging the topic name from the Project Manager and then changing the title of the referred topic: it does not change the reference text.
    Making a user defined variable: seems counterproductive because I will still be making one change too many.
    Example: I have a topic called VIP PO Approval that is referring to the VIP PO Upload/Entry topic. I am putting hyperlinks from the Approval topic to the Upload/Entry topic, but the text of the links should come from the "Upload/Entry" Topic Title field. If the powers that be change the spelling of Upload/Entry (perhaps include spaces around the slash), I only want to change it in the properties of that topic or rename it in Project Manager (the point is, in one place only).
    Does anyone know how to do this in RH9? Is there an enhancement in RH10?
    Thank you.

    I would add to Peter's response by saying this: When you drag and drop to create a link, what the link actually reads is dependent upon how you created the link. For example, if you select the text used to constitute the link, THEN drag to the selected text, the selected text is used instead of the Topic title. And sure, if you just drag the topic to an empty spot on the page, the Topic Title is used.
    Sure, it seems like an extra step is involved, but with RoboHelp 10, I defined a variable and used the variable as my topic title. I then dragged the variable to the selected text to create the variable. Then I dragged the desired topic to the variable to create the link. All seemed to work just fine with the link text updating when the variable was changed
    I think  any way you slice it you are going to have at least one extra step. But then again, anything that gives you more functionality tends to require an extra hoop or two, no? And on the up side, while an extra step is inovolved initially, you actually SAVE steps down the road. So overall, I'd say you are still in the benefit zone.
    Cheers... Rick
    Helpful and Handy Links
    RoboHelp Wish Form/Bug Reporting Form
    Begin learning RoboHelp HTML 7, 8 or 9 within the day!
    Adobe Certified RoboHelp HTML Training
    SorcerStone Blog
    RoboHelp eBooks

  • How do I create a variable that is a time?

    What I need is a variable that is a time such as 13:00 that can be used in an equation like 13:00 - 12:30 = 00:30 or 13:00 - 12:45 = 00:15 etc.
    I have no idea how to do this because if I use something like:
    var Onsite = 12:30
    var Offsite = 13:00
    I get the following message:
    Consecutive statements on a line must be separated by ;
    It is pointing to the : and that makes sense but if I use this:
    var Onsite = "12:30"
    var Offsite = "13:00"
    Then I can't use it as an equation because it is being treated as text.
    Any ideas?

    Look at the NSDate class if your using Objective-C (or Swift), it can be used to create points in time (date + time) and can determine the distance (in seconds) between to points, using the -timeIntervalSince* methods.

  • How create a variable that changes (by 0.05) on each iteration in a loop?

    We are trying to control  New Era Syringe pumps using Labview. We want that those pumps could dispense different volumes on wells. For example 0.05ml in well one (using actuators we can move the wells),  0.1ml in well 2, 0.15ml in well 3 and so on. We think that we may need a "For loop" in which the number of iteration is the number of wells, but we do not know how to create a variable, inside the loop that can increase .05 on each iteration, and then we can use that variable as a "volume input" in our program.

    Hi tbob,
    multiple add operations with floats may induce more errors than a multiply/divide due to floating point representations (especially on numbers that can't be represented exactly, like 0.05)... The next step in this routine might be a comparison of setpoint and measurement value
    Message Edited by GerdW on 05-10-2010 08:04 PM
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Can a dynamic select stmt in a ref cursor be done?

    Hello all!
    I have a form in which a user can select a number of checkboxes that coorespond to fields in a table. After checking the desired boxes, the user can then click on a button and a variable (v_query) in a "when button pressed" trigger is populated with the text of a sql query. The trouble is, I want to incorporate the code contained in v_query into the REF cursor OPEN statement where it is expecting a sql query. The idea here is that the cursor would loop through the table fetching rows based on the select statement variable (v_query) and write them to a file using TEXT_IO(See below code). First, can this be done? Second, is there a better way to do accomplish this?
    DECLARE
    TYPE t_cur IS REF CURSOR ; -- define t_cur as a type
    c_cur t_cur ; -- define an actual variable of type t_cur
    r_emp emp%ROWTYPE ; -- PL/SQL record to hold row
    v_query VARCHAR2(2000) := 'SELECT * FROM emp' ; -- the query!
    BEGIN
    -- OPEN FILE
    out_file := Text_IO.Fopen('C:\BACHELOR\TEST.txt', 'w');
    OPEN c_cur FOR v_query ; -- v_query could contain any valid query
    LOOP
    FETCH c_cur INTO r_emp ; -- get first row from dataset
    EXIT WHEN %NOTFOUND
    --PRINT TO FILE 
              Text_IO.Put_line(out_file, r_emp);
              Text_IO.New_Line(out_file);
    END LOOP;
    CLOSE c_cur ; -- remember to close the cursor! ;)
    END;

    Hello all!
    I have a form in which a user can select a number of checkboxes that coorespond to fields in a table. After checking the desired boxes, the user can then click on a button and a variable (v_query) in a "when button pressed" trigger is populated with the text of a sql query. The trouble is, I want to incorporate the code contained in v_query into the REF cursor OPEN statement where it is expecting a sql query. The idea here is that the cursor would loop through the table fetching rows based on the select statement variable (v_query) and write them to a file using TEXT_IO(See below code). First, can this be done? Second, is there a better way to do accomplish this?
    DECLARE
    TYPE t_cur IS REF CURSOR ; -- define t_cur as a type
    c_cur t_cur ; -- define an actual variable of type t_cur
    r_emp emp%ROWTYPE ; -- PL/SQL record to hold row
    v_query VARCHAR2(2000) := 'SELECT * FROM emp' ; -- the query!
    BEGIN
    -- OPEN FILE
    out_file := Text_IO.Fopen('C:\BACHELOR\TEST.txt', 'w');
    OPEN c_cur FOR v_query ; -- v_query could contain any valid query
    LOOP
    FETCH c_cur INTO r_emp ; -- get first row from dataset
    EXIT WHEN %NOTFOUND
    --PRINT TO FILE 
              Text_IO.Put_line(out_file, r_emp);
              Text_IO.New_Line(out_file);
    END LOOP;
    CLOSE c_cur ; -- remember to close the cursor! ;)
    END;

  • An issue with Dynamic SQL within Package using REF CURSOR

    Hi there,
    In the following package first two procedures works file but since I have added the third one ( GET_CONTRACT_BY_DYN_SQL) it does not work for me. When I try to compile and save it gives below error.
    "Error(6,15): PLS-00323: subprogram or cursor 'GET_CONTRACT_BY_DYN_SQL' is declared in a package specification and must be defined in the package body"
    Can you please help?
    Package Header
    create or replace
    PACKAGE CONTRACTS_PKG AS
    TYPE T_CURSOR IS REF CURSOR;
    PROCEDURE GET_CONRACTS (IO_CURSOR IN OUT T_CURSOR);
    PROCEDURE GET_CONTRACT_BY_ID (I_CONTRACTID IN NUMBER, IO_CURSOR IN OUT T_CURSOR);
    PROCEDURE GET_CONTRACT_BY_DYN_SQL(P_CONTRATID IN NUMBER, P_COLS IN VARCHAR2, IO_CURSOR IN OUT T_CURSOR);
    END CONTRACTS_PKG;
    Package Body
    create or replace
    PACKAGE BODY CONTRACTS_PKG AS
    -- Get All Contracts
    PROCEDURE GET_CONRACTS(IO_CURSOR IN OUT T_CURSOR)
    IS
    V_CURSOR T_CURSOR;
    BEGIN
    OPEN V_CURSOR FOR
    SELECT * FROM CONTRACTS;
    IO_CURSOR := V_CURSOR;
    END GET_CONRACTS;
    -- Get Contract By ID
    PROCEDURE GET_CONTRACT_BY_ID(I_CONTRACTID IN NUMBER, IO_CURSOR IN OUT T_CURSOR)
    IS
    V_CURSOR T_CURSOR;
    BEGIN
    OPEN V_CURSOR FOR
    SELECT * FROM CONTRACTS WHERE contract_id = I_CONTRACTID;
    IO_CURSOR := V_CURSOR;
    END GET_CONTRACT_BY_ID;
    -- Get Contract Using Dynamic SQL
    PROCEDURE GET_CONTRACT_BY_DYN_SQL(P_CONTRACTID IN NUMBER, P_COLS IN VARCHAR2, IO_CURSOR IN OUT T_CURSOR)
    IS
    V_CURSOR T_CURSOR;
    V_SQL VARCHAR2(200);
    BEGIN
    V_SQL := 'SELECT '|| P_COLS || ' FROM CONTRACTS WHERE contract_id = ' || P_CONTRACTID ;
    --OPEN V_CURSOR FOR
    --EXECUTE IMMEDIATE V_SQL INTO V_CURSOR;
    OPEN V_CURSOR FOR V_SQL;
    EXECUTE IMMEDIATE V_SQL;
    --IO_CURSOR := V_CURSOR;    
    END GET_CONTRACT_BY_DYN_SQL;
    END CONTRACTS_PKG;
    Thanks in advance.
    Hitesh

    Thanks guys. Finally I have tweaked as per your suggestions and it's working for all 3 cases (stored procedures).
    Oracle
    ======
    Package Header
    create or replace
    PACKAGE CONTRACTS_PKG AS
    TYPE T_CURSOR IS REF CURSOR;
    PROCEDURE GET_CONRACTS (IO_CURSOR IN OUT T_CURSOR);
    PROCEDURE GET_CONTRACT_BY_ID (I_CONTRACTID IN NUMBER, IO_CURSOR IN OUT T_CURSOR);
    PROCEDURE GET_CONTRACT_BY_DYN_SQL(P_CONTRACTID IN NUMBER, P_COLS IN VARCHAR2, IO_CURSOR IN OUT T_CURSOR);
    END CONTRACTS_PKG;
    Package Body
    create or replace
    PACKAGE BODY CONTRACTS_PKG AS
    -- Get All Contracts
    PROCEDURE GET_CONRACTS(IO_CURSOR IN OUT T_CURSOR)
    IS
    V_CURSOR T_CURSOR;
    BEGIN
    OPEN V_CURSOR FOR
    SELECT * FROM CONTRACTS;
    IO_CURSOR := V_CURSOR;
    END GET_CONRACTS;
    -- Get Contract By ID
    PROCEDURE GET_CONTRACT_BY_ID(I_CONTRACTID IN NUMBER, IO_CURSOR IN OUT T_CURSOR)
    IS
    V_CURSOR T_CURSOR;
    BEGIN
    OPEN V_CURSOR FOR
    SELECT * FROM CONTRACTS WHERE contract_id = I_CONTRACTID;
    IO_CURSOR := V_CURSOR;
    END GET_CONTRACT_BY_ID;
    -- Get Contract Using Dynamic SQL
    PROCEDURE GET_CONTRACT_BY_DYN_SQL(P_CONTRACTID IN NUMBER, P_COLS IN VARCHAR2, IO_CURSOR IN OUT T_CURSOR)
    IS
    V_CURSOR T_CURSOR;
    V_SQL VARCHAR2(200);
    BEGIN
    IF p_contractid > 0 THEN
    V_SQL := 'SELECT '|| P_COLS || ' FROM CONTRACTS WHERE contract_id = ' || P_CONTRACTID ;
    ELSE
    V_SQL := 'SELECT '|| P_COLS || ' FROM CONTRACTS';
    END IF;
    OPEN V_CURSOR FOR V_SQL;
    IO_CURSOR := V_CURSOR;
    END GET_CONTRACT_BY_DYN_SQL;
    END CONTRACTS_PKG;
    ColdFusion (calling app code)
    =====================
    <cfstoredproc procedure="CONTRACTS_PKG.GET_CONTRACT_BY_ID" datasource="#REQUEST.dsn#">
         <cfprocparam cfsqltype="CF_SQL_INTEGER" type="in" value="1" variable="I_CONTRACTID">
         <cfprocresult name="qData" resultset="1">
    </cfstoredproc>
    <br>Single Contract:
    <cfdump var="#qData#" label="Single Contract">
    <cfstoredproc procedure="CONTRACTS_PKG.GET_CONRACTS" datasource="#REQUEST.dsn#">     
         <cfprocresult name="qDataAll" resultset="1">
    </cfstoredproc>
    <br>All Contracts:
    <cfdump var="#qDataAll#" label="All Contracts">
    <cfstoredproc procedure="CONTRACTS_PKG.GET_CONTRACT_BY_DYN_SQL" datasource="#REQUEST.dsn#">
         <cfprocparam cfsqltype="CF_SQL_INTEGER" type="in" value="1" variable="P_CONTRACTID">
         <cfprocparam cfsqltype="CF_SQL_VARCHAR" type="in" value="contract_number,contract_title,created_date" variable="P_COLS">
         <cfprocresult name="qDataDynSQL" resultset="1">
    </cfstoredproc>
    <br>Dynamic SQL Query:
    <cfdump var="#qDataDynSQL#" label="Dynamic SQL Query">
    Thanks,
    Hitesh Patel

  • Creating Web services using JDeveloper for Pl/SQL package having ref cursor

    Hi,
    I am trying to create web services for PL/SQL package in JDeveloper. When I am trying to create this web service, the functions in the package which is returning referential cursor or record cursor are not visible. When I highlight the function and click "Why Not?", it displays the message "The following types used by the program unit do not have an XML schema mapping and/or serializer Specified: REF CURSOR". Could you please let me know, how I can create this web service?
    I am getting similar error when I am trying to create web service for a package with overloaded functions also.
    Thanks,

    Ok so I played around with this some more. I created the same process in bpel using oracle bpel designer and here are the results.
    1. Against 10g database running a synch process data is retutned without error.
    2. Against 9i database running an asynch process data is retutned without error.
    3. Against 9i database running a synch process data is retutned with error.
    I'm definilty missing something.

  • Creating a variable with a dynamic name

    I read a XML which has a unknown number of
    TextFormat-Definitions.
    I used Arrays to hold the data. Every time the TextFormat
    should be used, I overwrite a temporary one with the data i hold in
    the array and then I apply this format to the specific text.
    Now I want to optimise this and create TextFormats at once
    which can be applied when needed, without all the conversion.
    The best way I can think of is by having
    dynamic names for the
    TextFormats for the user to call.
    I can't use the way I did in AS2:
    var ["TF_"+string]:TextFormat = new TextFormat(x,y,z);
    How is the
    right Syntax in ActionScript3.0?

    Yeah, the Application class is no longer dynamic, so you can
    just add members on the fly.
    You could create an "associative array" (object), and store
    the formats in that, keyed by 'string". Associative arrays are like
    hash tables and are efficient at looking up values by key.
    I have heard of but not used Dictionary objects.
    Tracy

  • How do I create a variable that uses Previous() and references itself.

    I am trying to create a crosstab with a number of meaures in it. I have a variable called opening stock and another called closing stock. The opening stock for day 2 is the closing stock for day 1 and is a variable [LV Opening Stock] defined as =Previous([closing stock];Row).  This works fine. But, the closing stock for day 2 is the opening stock plus production minus sales. So my variable has to reference the previous days closing stock.
    When it is defined as =[LV Opening Stock]+[Planned Production Qty]-[Forecast Daily Qty] it validates but when I try to save it I get the following message :  The formula for variable [LV Opening Stock] contains a reference to a variable with the same short name. You must use the fully-qualified variable name in the formula to remove this ambiguity. (Error: WIS 10040)
    How do I solve this? What is the fully-qualified name? Is it because it's effectively referencing itself?
    I'm using XI R2 sp4
    Thanks
    John

    Hi. I'm having the same issue. Please share with us if you find a solution.
    Many thanks.

  • Alternative to native, dynamic sql to return a ref cursor to a client

    I'm on Oracle 8.0.4, and would like to pass a string of values like '1,2,7,100,104' that are the primary key for a table. Then use something like:
    procedure foo( MyCur RefCurType, vKey varchar2)
    begin
    open MyCur for
    'select names from SomeTable' &#0124; &#0124;
    ' where ID in (' &#0124; &#0124; vKey &#0124; &#0124; ')'
    end;
    This would return a recordset to (in this case) a Crystal Reports report.
    However, native dynamic SQL ain't available until 8.1.0. So can anyone think of a clever way to accomplish this, with a way to return a cursor? I can't figure out how to do this with DBMS_SQL, because open_cursor is just returning a handle, not a referene to a cursor that can be passed to a remote client.
    Thanks in advance.

    I'm on Oracle 8.0.4, and would like to pass a string of values like '1,2,7,100,104' that are the primary key for a table. Then use something like:
    procedure foo( MyCur RefCurType, vKey varchar2)
    begin
    open MyCur for
    'select names from SomeTable' &#0124; &#0124;
    ' where ID in (' &#0124; &#0124; vKey &#0124; &#0124; ')'
    end;
    This would return a recordset to (in this case) a Crystal Reports report.
    However, native dynamic SQL ain't available until 8.1.0. So can anyone think of a clever way to accomplish this, with a way to return a cursor? I can't figure out how to do this with DBMS_SQL, because open_cursor is just returning a handle, not a referene to a cursor that can be passed to a remote client.
    Thanks in advance.

  • Workflows: How to set a workflow variable that is the difference in hours between now and a created date

    I'm trying to create a variable that contains the number of hours between the item created date and Now.  When i use TODAY, it seems to set the time at 12:00 rather than the time now - so that throws the hours off.  Any ideas?
    ajw

    Hi ajw,
    According to your description, my understanding is that you want to calculate the hours between the item created date and now.
    It seems to be not an OOB way to implement your requirement, to get the current time, you need to create a custom workflow activity for SharePoint 2010 workflow. About creating custom workflow activity, you can refer to the links below:
    http://msdn.microsoft.com/en-us/library/hh872790(v=office.14).aspx
    http://blogs-sharepoint-ashutoshmisra.blogspot.in/2013/02/create-custom-workflow-action-for.html
    Or, you can use a third party solution to achieve your requriement.
    Here are some similar posts for you to take a look at:
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/e93ea37a-df09-4cbf-a58d-5d4def3d3d42/how-to-compare-time-in-sharepoint-designer-2010sp-2010-workflow?forum=sharepointgeneralprevious
    http://blog-sharepoint.blogspot.in/2009/03/get-current-time-in-sharepoint-designer.html
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • Can I have a variable that lists the name of the Book?

    Hi, I'm creating a document as an InDesign Book, ie a lot of documents in the Book Pallette. I'd like to have a variable that lists the book name. Is this possible?
    I've tried finding how to create new variables but I can't see anything. I'm guessing <$bookname> is the code but I can't figure out how to enter it as a variable in CS5.
    Thanks,

    What does this have to do with scripting? I don't believe you can create a variable that is automatically populated with the book name, but you can simply create a regular variable and synchronize it across all documents in the book.

  • Ref cursors and dynamic sql..

    I want to be able to use a fuction that will dynamically create a SQL statement and then open a cursor based on that SQL statement and return a ref to that cursor. To achieve that, I am trying to build the sql statement in a varchar2 variable and using that variable to open the ref cursor as in,
    open l_stmt for refcurType;
    where refcurType is a strong ref cursor. I am unable to do so because I get an error indication that I can not use strong ref cursor type. But, if I can not use a strong ref cursor, I will not be able to use it to build the report based on the ref cursor because Reports 9i requires strong ref cursors to be used. Does that mean I can not use dynamic sql with Reports 9i ref cursors? Else, how I can do that? Any documentation available?

    Philipp,
    Thank you for your reply. My requirement is that, sometimes I need to construct a whole query based on some input, and sometimes not. But the output record set would be same and the layout would be more or less same. I thought ref cursor would be ideal. Ofcourse, I could do this without dynamic SQL by writing the SQL multiple times if needed. But, I think dynamic SQL is a proper candidate for this case. Your suggestion to use lexical variable is indeed a good alternative. In effect, if needed, I could generate an entire SQL statement and place in some place holder (like &stmt) and use it as a static SQL query in my data model. In that case, why would one ever need ref cursor in reports? Is one more efficient over the other? My guess is, in the lexical variable case, part of the processing (like parsing) is done on the app server while in a function based ref cursor, the entire process takes place in the DB server and there is probably a better chance for re-use(?)
    Thanks,
    Murali.

Maybe you are looking for