As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only. Moving forward, myibi is our community platform to learn, share, and collaborate. We have the same Focal Point forum categories in myibi, so you can continue to have all new conversations there. If you need access to myibi, contact us at email@example.com and provide your corporate email address, company, and name.
Hello- If this DataMigrator post belongs in a different forum, please let me know and I'll move it accordingly.
In DataMigrator (DMC), I am trying to create a synonym that represents a complex query. I'm looking for a way to supply a custom query as the definition of the synonym. In my case, I have a table that recursively refers to itself (ex. Employee table with a manager ID column pointing back to employee ID of different row). I need to traverse the records for relations and build a list of descendant records (ex. A particular Department Head and all employees underneath). Oracle is the DBMS holding the table, so I can leverage the CONNECT BY analytic function (or the ANSI SQL WITH keyword equivalent) in a SQL select statement to get the desired results, but I can't find a way to place that SQL in a synonym. The closest I found was being able to place the SQL in a custom SQL object in the data flow. Unfortunately, the Test SQL statement button returns errors for both the Oracle and ANSI syntax SQL statements. It appears the custom SQL object does not support the syntax.
Does anyone have any suggestions on how to create a recursive listing that can be reused in many dataflows? Thanks.This message has been edited. Last edited by: FP Mod Chuck,
Welcome to Focal Point! It is a great forum for getting answers to your development questions!
DataMigrator questions usually fall under the iWay Software product forum but you don't have to move it there this time.
I am not a SQL expert by any means and your SQL sounds complex. I think you want to create a DBMS SQL Flow and choose your Oracle connection under the properties. The datamigrator user guide describes this flow in chapter 5. When you use this type of flow a synonym is not required as it will pass your oracle specific SQL directly to Oracle for processing. The result set of that can then be loaded into a separate Oracle table.
Thank you for using Focal Point!
Chuck Wolff - Focal Point Moderator WebFOCUS 7x and 8x, Windows, Linux All output Formats
Posts: 2128 | Location: Customer Support | Registered: April 12, 2005
Thank you for the quick reply! I will put future DMC posts in the iWay Software Product forum.
I was able to follow your advice and create a DBMS SQL Flow with a hardcoded literal value in the SQL statement, but I could not find a way to pass a variable into it for filtering sake. Without filtering, this query would become extremely expensive. Is there a way to pass in a filtering criteria such as an ID (ex. WHERE emp_id = &&emp_id_var)?
If not, I also tried the route of creating a stored procedure as the basis for the synonym. I was able to create the synonym this way, and the sample data dialog would allow me to supply a value for the stored procedure's input variable. However, I could not find any way to specify a variable in the synonym or dataflow using the synonym so that a value could be passed in at runtime. Surely there's a way to supply stored procedure input values at runtime, but I could not figure it out nor any documentation.
Support for using variables in a DBMS SQL Flow was added in Release 7.7.08M. You may want to upgrade to the current production release.
When you create a synonym for a database stored procedure you can pass a value to an input parameter a WHERE condition for a single value.
For example if you had the classic ORACLE sample schema scott and followed the instructions in the DMUG in the section "How to Use a Relational Stored Procedure as a Data Source" to create a procedure and synonym you could then use that synonym as a data source. Then you would add a WHERE condition T1.PEMPNO = &EMPNO. When you test or run the procedure it would prompt you for EMPNO and you enter a value like 7839 and you'll get back one row.
To submit or schedule the flow you would provide a value in a stored procedure.
One more thing. To address your original question about how to create a synonym that reflects a complex query you can do that too, as long as it returns a single answer set. Save the query in file a with extension of sql. Then when you create a synonym in the Object Type pull-down select External SQL Scripts and enter the location and name.
Now you can use that synonym as a data source as you would use any other. Of course you can't use them as targets.
Posts: 397 | Location: New York City | Registered: May 03, 2007
I'll check with our installation guys what our plan is for upgrading to 7.7.08M.
I also followed your instructions on supplying a variable to a stored procedure. After a few missteps (I'm still pretty new to DMC), I was able to get it to work. I was also able to get the SQL file synonym source to work.