Possible? SQL table link to InDesign Table
My company uses indesign for all of our work instructions. We have a database of our bill of materials - we export data from this database to excel, and dump that table into indesign. my question is - is there a way to link an indesign table directly to SQL, or if I set up a data connection in the Excel table, will it update dynamically when the indesign (or exported PDF) file is opened?
cgpl_project contains the information you are looking for for the promotion guid. Also you can link the crm_mktpl_attr.responsible to the but000 table on partner_guid to get the Employee Responsible name.
Similar Messages
-
Tables:Linking excise part1 table entries with relevant storage location
Dear experts
I want to link the excise table entries to the relevant storage location at the time of excise relevant goods movement ( includes , GR , consumption & returns etc)
Can anyone please tell me the tables that wud have to be searched?
regards,
Edited by: Prasanna Shetty on Dec 4, 2008 12:04 PMHello,
J_1IEXCDTL = Excise invoice line item details
J_1IEXCHDR = Excise invoice header detail
All excise related tables you will get by entering J_1i* in table name and press F4 in SE16.
Regards,
Shailesh -
Sorting not working if table linked to another table
Got a table with student marks:
Table 1 student
mark
A
98
B
79
C
82
if I copy/paste the marks to another table then sort (ascending, sort by B entire table), it is sorting as expected:
Table 2 student
Mark
B
79
C
82
A
98
if instead I go in Table 2 and enter a formula in B2 to get the mark from table 1 (=Table1::B2), fill down the cells, Table 2 will not sort correctly and output this instead!!!!:
Table 2 student
Mark
B
98
C
79
A
82
Yet another bug and it got submitted to Apple but if more users complain as well (using Provide Numbers Feedback), we might finally get Apple to release a bug-free version of Numbers that works as well as Excel for such basic tasks.squarebox is styled in three different places
http://mljdesigns.com.au/Beaumaris%20North_2-2013/index-beaunps4.css line#513
http://mljdesigns.com.au/Beaumaris%20North_2-2013/index-beaunps4.css line#623
In the main document line#10
I do noy know if this has anything to do with your problem as I cannot fault the position of the image.
You may also want to have a look at line#104 of the main document where there is a stray ending division tag. -
[CS3][VBS]Converting a CALS table to Indesign table in XML
Hi!<br /><br />I have an xml-file with tables that I want to import into Indesign. It works fine when I use the Import CALS tables as Indesign tables in "Import options", but the problem is when I do this some emphasis elements inside the "entry" elements isn't found when I try to use XMLRules to format the emphasis elements in the document...<br />The structure of the table can be like this (in general):<br />Tabell<br /> table<br /> tblgrp<br /> tbody<br /> row<br /> <entry>Some text...<emp Type = "bold">bold text</emp></entry><br /> <entry>Some text</entry><br /> <entry>some text</entry><br /> row<br /> tbody<br /> tblgrp<br /> table<br /> Tabell<br /><br />When I import the Table as CALS tables to Indesign tables, the table structure is collapsed into just a <Tabell> element. I assume this is the reason why the <emp> element isn't found.<br /><br />I try to solve this by NOT importing CALS tables to Indesign tables. I see then that the whole table structure is intact in the structure panel and the <emp> elements are also found by the XMLRules, but the contents is not put inside a table in the indesign document. To put the table elements into a table in Indesign I use the Command: "ConvertElementToTable" but this doesnt work very well. I use it in XMLRules like this:<br /><br />Public Property Get xpath()<br />xpath = "//Tabell"<br />End Property<br /><br />Public Function apply(myXMLElement, myRuleProcessor)<br />With myXMLElement<br />.ConvertElementToTable "row", "entry"<br />End With<br />apply = False<br />End Function<br /><br />Does anyone have any experience of importing XML-tables in Indesign and formatting them? I could really need some to put the xml table into Indesign tables...Please help!<br /><br />In advance thanks!
Hi!
Just check the checkbox "Import CALS tables as Indesign tables" in the XML import options dialogbox. Then it should go automatically.
The problem with this approach is that the entire table structure is collapsed to a single table element in the struture. If one want to do some xml-prosessing at row or cell level one need to to this outside indesign or not import CALS as Indesign tables. The big question is if there is some easy way to convert a CALS table to an Indesign table inside Indesign after one have imported the data and prosessed the row and cell elements...
Hope anyone knows more than me about this....
Anyway, mkarthic, I hope my answer helped you to import your CALS tables!:-)
Greetings
Pål -
Sql Query : Sum , all the possible combination of rows in a table
SQL Server 2008 R2
Sample Table structure
create table TempTable
ID int identity,
value int
insert into TempTable values(6)
insert into TempTable values(7)
insert into TempTable values(8)
insert into TempTable values(9)
insert into TempTable values(10)
I actually want something like below,
that It returns rows such that, it has the sum of all the remaining rows , as shown below.
I will ignore the repeated rows.
6+7
6+8
6+9
6+10
6+7+8
6+7+9
6+7+10
6+8+9
6+8+10
6+9+10
6+7+8+9
6+7+8+9+10This makes no sense. What about NULLs? What about duplicate values? You have rows, so you have many combinations. We know that this set totals to 39, so there is no subset totals to half of any odd number. 19.5
in this case.
None of your examples are
even close!
6+7 = 13
the remaining rows 8+9+10 = 27, so you failed!
Want to try again?
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL -
Convert table linked report into a Command version - Howto?
How can I convert hundreds of reports from table linked into a Command version?
One way to do is to take the SQL syntax off the report, add a Command with that Syntax and manually replace the database fields by the Command fields.
I can not believe that is the right way to this. Is there no hidden (re-)mapping fields button or another undocumented feature?
If this is the way to do it... when will there be a one-button-click solution. The underlaying data keeps the same, could not be that hard to build..?
Without that basic functionality Crystal Reports is not option for us anymore.
Backgroud: We do have hundreds of reports that are created by an ODBC (RDO) database (SQL Anywhere database), created by linking the tables and select the fields we like to use in the report. This works fine at least as we used the RDC method in our application. Because we are moving to .NET we could not use RDC anymore and have to use the .NET methods. However the .NET SDK is very limited. The only way to add more complex WHERE statements is to use the Command functionality of Crystal Reports.Hi Hans,
Let me explain, Command Objects are sent directly to the DB server as is. CR does not alter the SQL at all. As you know in SQL there are minor differences between the various servers and the SQL syntax can vary from DB to DB. Because of this CR could not build in the logic to handle the vast number of potential mappings, and not jsut SQL types but also PC databases.
To be able to map reports based on connections directly to the DB through a Command object the current versions of CR do not have the ability. Possibly the next version may have this feature though but we can't say for sure until it's released. Check our WEB site for new versions and there functionality.
Next question about moving off of the RDC to .NET, you are correct. CR no longer allows you to modify the SQL statement directly. The RDC was actually supposed to stop you also but it did work.
One possible solution is to use .NET and inProc RAS ( Report Application Server) and using record sets. Your app can get the SQL from the report, process the query and appending the info onto the WHERE clause as well as other filtering and then set the existing reports data source to the record set. As long as your data is less than 5000 rows then no performance issues, over 5K and you may start to see slow report processing. Depends on other info and report complexity etc.
If this is an option for you please post your question to the Crystal .NET development forum. Also, you will need to use 12.x.2000.x versions of the CR .NET assemblies and not use the basic version 10.5 or 10.2 that comes with .NET 2008 and 2005.
Thank you
Don -
ORACLE EXPRESS: build a page with multiple forms linked to one table
hi,
im using oravle application express. APEX
i would like to build a page with multiple forms linked to one table (orders) , the page has 4 from each one with different order_id number (depending on filtering), and if the order is prepared click yes for each order and this 'YES' should be UPDATED AND SAVED to each order number in the same table with the press of one button.
i created all the form as (sql query)
and create one update process
(UPDATE ORDERS
SET TRAY_PREPARED =:P10_TRAY_PREPARED_1
WHERE ORDER_ID =:P10_ORDER_ID_1;
UPDATE ORDERS
SET TRAY_PREPARED =:P10_TRAY_PREPARED_2
WHERE ORDER_ID =:P10_ORDER_ID_2;
UPDATE ORDERS
SET TRAY_PREPARED =:P10_TRAY_PREPARED_3
WHERE ORDER_ID =:P10_ORDER_ID_3;
UPDATE ORDERS
SET TRAY_PREPARED =:P10_TRAY_PREPARED_4
WHERE ORDER_ID =:P10_ORDER_ID_4;
i dont know really if i can do that, but it appear hat it actually saving according to order_id number , but not all the time some time it saved the value as "null".
please guide me what is the correct way to do this.
I READ THIS ONE
http://stackoverflow.com/questions/7877396/apex-creating-a-page-with-multiple-forms-linked-to-multiple-related-tables
BUT IT WAS FOR MULTIPLE INSERT
thanks.Sans,
I am no Apex expert, but with a situation as "complex" as yours, have you thought about creating a VIEW that joins these 7/8 tables, placing an INSTEAD OF trigger on that view to do all the business logic in the database, and base your application on the view?
This is the "thick-database" approach that has been gaining momentum of late. The idea is to put your business logic in the database wherever possible, and let the application (Form, Apex, J2EE, whatever) concentrate on UI issues, -
Changing link properties between tables
Hello,
Is it possible to change somehow properties for the links between tables?
We have about 2000 reports and we should change most of the links, it would be very convenient to write short program to do this instead of destroying couple mouses and wrists etc...
Currently we are using VB6 and RDC to work with reports but we are open for all ideas to solve this problem we have.
Thanks in advance for any help!
TimoHi Timo,
Unless you know exactly how all are going to change exactly it may be easier to hire a student to this for you.
Here's a bit of code that should get you going, it's old but should work for you also. You'll need to know what fields are mapped etc... It actually adds the tables at runtime and what you'll want to do is get your existing tables and links and save the info in an array.
Dim db As Database
Set db = rep.Database
Dim tables As ICRDatabaseTables
Set tables = db.tables
Dim desTable As ICRDatabaseTable
Dim path As String
Dim srcTable As ICRDatabaseTable
Dim subloc As String
' Add a table.
subloc = "Orders"
Set srcTable = tables.Add(subloc, CRDTRecurringFile, "crdb_ODBC.DLL", "MS SQL Tsvanfps01", "nwind", "vantech", "vantech", subloc)
' Add a table.
subloc = "Employees"
Set desTable = tables.Add(subloc, CRDTRecurringFile, "crdb_ODBC.DLL", "MS SQL Tsvanfps01", "nwind", "vantech", "vantech", subloc)
Dim links As ICRDatabaseLinks
Set links = db.links
Dim count As Long
count = links.count
Dim joinType As CRJoinType
Dim lookType As CRLookUpType
Dim pm As Boolean
Dim indexInUse As Integer
joinType = 5 ' set to Left Outer Join
lookType = 2
pm = False ' used for Access tables
indexInUse = 0 ' used for Access tables
Dim vas As Variant
Dim vbs As Variant
vas = Array(2) ' pointer to the field position in the source Table
vbs = Array(0) ' pointer to the field position in the destination Table
Dim newdblink As ICRDatabaseLink
Set newdblink = links.Add(srcTable, desTable, vas, vbs, joinType, lookType, pm, indexInUse)
Have fun
Don -
Tuning of SQL query in PO base tables
Hi all,
Is there any way to optimize the below query as its taking too many hours to exectute when I pass the dates parameters for long period like eg. 6months to 1 year. Am I missing something...?
SELECT poh.org_id,
rcvt.organization_id,
mcat.segment1,
pov.vendor_name,
poh.vendor_id,
rcvt.transaction_type,
rcvt.primary_quantity,
poh.rate,
pol.unit_price,
NULL,
pvs.attribute8,
pvs.address_line1,
pvs.address_line2,
pvs.city,
pvs.state,
pvs.zip,
pvs.country
FROM rcv_transactions rcvt,
mtl_item_categories icat,
po_line_locations_all poll,
po_lines_all pol,
mtl_system_items_b msi,
po_headers_all poh,
po_vendors pov,
mtl_categories_b mcat,
po_vendor_sites_all pvs,
mtl_categories_b mcatedi
WHERE pov.vendor_id = poh.vendor_id
AND poh.po_header_id = pol.po_header_id
AND msi.inventory_item_id = pol.item_id
AND pov.vendor_id = pvs.vendor_id
AND pvs.vendor_site_id = poh.vendor_site_id
AND msi.organization_id = 117
AND mcatedi.category_id = pol.category_id
AND poll.po_line_id = pol.po_line_id
AND icat.organization_id = msi.organization_id +0
AND icat.inventory_item_id = msi.inventory_item_id +0
AND icat.category_set_id = 1
AND icat.category_id = mcat.category_id
AND rcvt.po_line_location_id = poll.line_location_id
AND rcvt.transaction_date BETWEEN p_Start_Date AND p_End_Date
AND ((rcvt.transaction_type = 'RETURN TO VENDOR') OR (rcvt.transaction_type = 'RECEIVE' ))
AND ((rcvt.transaction_type = 'RECEIVE') OR (rcvt.transaction_type = 'RETURN TO VENDOR')
AND nvl(rcvt.reason_id, 110) IN
SELECT reason_id
FROM mtl_transaction_reasons
WHERE disable_date IS NULL AND reason_id NOT IN(20 , 21 , 22 , 23, 24 , 25 , 26 ,27 , 28 , 29 , 50 , 51 , 52 , 53 , 54 , 55 ,100 ,102, 103, 122 ,123 , 124)
Thank you all in advance....This is the explain I have in my instance. Looks like there is a different in indexes.
I have no full table scan on any table in the SQL I sent you. There are the changes I have made:
Removing the table --, mtl_categories_b mcatedi. It is not necessary to link the categories to PO lines unless you are entering POs without items. That I think you are not (looks like) as you are looking at the transactions line Receive and Retrun to vendor so I assumed these inventory purchases where you are using item. Hence removed that.
One more possibility is that you are reciving the expense POs also (accruing on receipt for expese purchases). If you want to add that table and condition (AND mcatedi.category_id = pol.category_id) add that and test.
Mistakenly commented out AND pvs.vendor_site_id = poh.vendor_site_id. You can add that back.
Added this where condition:
AND rcvt.organization_id = msi.organization_id
Reason: You are receiving into organization where the item is assigned to. If you remove this where condition it will do full table scan on the tables you mentioned along with the po_vendors_all. This is what making all the difference.
Remaining all is your SQL only.
SQL
====================================
SELECT poh.org_id, rcvt.organization_id, mcat.segment1, pov.vendor_name, poh.vendor_id
, rcvt.transaction_type, rcvt.primary_quantity, poh.rate, pol.unit_price, NULL, pvs.attribute8
, pvs.address_line1, pvs.address_line2, pvs.city, pvs.state, pvs.zip, pvs.country
FROM po_headers_all poh
, po_lines_all pol
, po_line_locations_all poll
, po_vendors pov
, po_vendor_sites_all pvs
, rcv_transactions rcvt
, mtl_system_items_b msi
, mtl_item_categories icat
, mtl_categories_b mcat
, mtl_categories_b mcatedi
WHERE poh.po_header_id = pol.po_header_id
AND pol.po_line_id = poll.po_line_id
AND poh.vendor_id = pov.vendor_id
AND pov.vendor_id = pvs.vendor_id
AND pol.item_id = msi.inventory_item_id
AND rcvt.organization_id = msi.organization_id
AND pvs.vendor_site_id = poh.vendor_site_id
AND msi.organization_id = 117
AND mcatedi.category_id = pol.category_id
AND msi.organization_id = icat.organization_id
AND msi.inventory_item_id = icat.inventory_item_id
AND icat.category_set_id = 1
AND icat.category_id = mcat.category_id
AND rcvt.po_line_location_id = poll.line_location_id
AND trunc(rcvt.transaction_date) BETWEEN ('01-JAN-2008') AND ('31-MAR-2008')
AND ((rcvt.transaction_type = 'RETURN TO VENDOR') OR (rcvt.transaction_type = 'RECEIVE'))
AND ( (rcvt.transaction_type = 'RECEIVE')
OR (rcvt.transaction_type = 'RETURN TO VENDOR')
AND NVL (rcvt.reason_id, 110) IN (
SELECT reason_id
FROM mtl_transaction_reasons
WHERE disable_date IS NULL
AND reason_id NOT IN
(20
, 21
, 22
, 23
, 24
, 25
, 26
, 27
, 28
, 29
, 50
, 51
, 52
, 53
, 54
, 55
, 100
, 102
, 103
, 122
, 123
, 124
==================
Plan
======================
SELECT STATEMENT CHOOSECost: 388 Bytes: 306 Cardinality: 1
30 FILTER
26 NESTED LOOPS Cost: 388 Bytes: 306 Cardinality: 1
24 NESTED LOOPS Cost: 388 Bytes: 302 Cardinality: 1
21 NESTED LOOPS Cost: 387 Bytes: 290 Cardinality: 1
18 NESTED LOOPS Cost: 385 Bytes: 150 Cardinality: 1
15 NESTED LOOPS Cost: 384 Bytes: 122 Cardinality: 1
12 NESTED LOOPS Cost: 383 Bytes: 91 Cardinality: 1
10 NESTED LOOPS Cost: 381 Bytes: 73 Cardinality: 1
8 NESTED LOOPS Cost: 380 Bytes: 64 Cardinality: 1
5 NESTED LOOPS Cost: 379 Bytes: 41 Cardinality: 1
2 TABLE ACCESS BY INDEX ROWID PO.RCV_TRANSACTIONS Cost: 378 Bytes: 31 Cardinality: 1
1 INDEX RANGE SCAN NON-UNIQUE PO.RCV_TRANSACTIONS_N22 Cost: 11 Cardinality: 3,490
4 TABLE ACCESS BY INDEX ROWID PO.PO_LINE_LOCATIONS_ALL Cost: 1 Bytes: 10 Cardinality: 1
3 INDEX UNIQUE SCAN UNIQUE PO.PO_LINE_LOCATIONS_U1 Cardinality: 1
7 TABLE ACCESS BY INDEX ROWID PO.PO_LINES_ALL Cost: 1 Bytes: 23 Cardinality: 1
6 INDEX UNIQUE SCAN UNIQUE PO.PO_LINES_U1 Cardinality: 1
9 INDEX UNIQUE SCAN UNIQUE INV.MTL_SYSTEM_ITEMS_B_U1 Cost: 1 Bytes: 9 Cardinality: 1
11 INDEX RANGE SCAN UNIQUE INV.MTL_ITEM_CATEGORIES_U1 Cost: 2 Bytes: 18 Cardinality: 1
14 TABLE ACCESS BY INDEX ROWID PO.PO_HEADERS_ALL Cost: 1 Bytes: 31 Cardinality: 1
13 INDEX UNIQUE SCAN UNIQUE PO.PO_HEADERS_U1 Cardinality: 1
17 TABLE ACCESS BY INDEX ROWID PO.PO_VENDORS Cost: 1 Bytes: 28 Cardinality: 1
16 INDEX UNIQUE SCAN UNIQUE PO.PO_VENDORS_U1 Cardinality: 1
20 TABLE ACCESS BY INDEX ROWID PO.PO_VENDOR_SITES_ALL Cost: 2 Bytes: 140 Cardinality: 1
19 INDEX RANGE SCAN UNIQUE PO.PO_VENDOR_SITES_U1 Cost: 1 Cardinality: 1
23 TABLE ACCESS BY INDEX ROWID INV.MTL_CATEGORIES_B Cost: 1 Bytes: 12 Cardinality: 1
22 INDEX UNIQUE SCAN UNIQUE INV.MTL_CATEGORIES_B_U1 Cardinality: 1
25 INDEX UNIQUE SCAN UNIQUE INV.MTL_CATEGORIES_B_U1 Bytes: 4 Cardinality: 1
29 FILTER
28 TABLE ACCESS BY INDEX ROWID INV.MTL_TRANSACTION_REASONS Cost: 1 Bytes: 4 Cardinality: 1
27 INDEX UNIQUE SCAN UNIQUE INV.MTL_TRANSACTION_REASONS_U1 Cardinality: 1
Thanks
Nagamohan -
Force Table Link In Crystal Report XI
Post Author: svettori
CA Forum: Data Connectivity and SQL
Good morning evrybody.
I am looking for a solution in order to link 2 tables where field type are different even if they manage the same information.I have several report created under CR 8.5 using this link between my 2 tables and since I change for CR XI it doesn't work anymore.
Our software provider cannot change this in its oracle DB so is there any possibility to force the link between to table event if datatype is <>
Thanks in advance.Post Author: Jagan
CA Forum: Data Connectivity and SQL
Is there any chance you could create a view to link the tables and report off the view? -
I want to creat a "print table" link in my document...
I am creating an interactive pdf document in InDesign. I want people to be able to click on a link to "print table". Someone in the InDesign forums said I would have to use Acorbat to do that and that I should post in these forums.
Is this something I can create using Acrobat? Could someone give me an idea of how I would do that, and how it would work in terms of my InDesign document?The closest you can get to that is a button that prints just the page the
table is on.
But if your users use Acrobat (ie not Reader), then it's possible to create
a script that will print the page the table is on, with only the table on
it, but that will require a bit of scripting knowledge. -
"The new table link contain TargetFieldNames that are not valid?
I am designing a report based on a sql stored procedure with 3 parameters required. I have a parameter that I would like to make dynamic based on an "Item" table for multiple selections.
I keep getting this error when I run the report
Prompting failed with the following error message: 'List of VAlues failure: fail to get values. (Cause of error: the new table link contains TargetFieldNames that are not valid. Error source: prompt.dll
Error code: 0x8004380d
Can someone point me to an example or tell me if this even possible to do?
Edited by: SHARON SCHMIDT on Feb 17, 2009 3:16 PMHi Sharon,
Searching for the error message got many KBase but I hope referring to the following would help you:
1211133 - Using parameters to select one, some or all values in a record selection formula
1220118 - Error: "List of Values failure"prompt.dll Error code: 0x8004380D"
Regards,
Sheeba -
Hi all,
Long time ago, I manually created a Database (APGriMMRP) and 3 Tables (dbo.Table_1_XYcoordinates, dbo.Table_2_Soil, and dbo.Table_3_Water) in my SQL Server 2012 Management Studio (SSMS2012). The dbo.Table_1_XYcoordinates has the following columns: file_id,
Pt_ID, X, Y, Z, sample_id, Boring. The dbo.Table_2_Soil has the following columns: Boring, sample_date, sample_id, Unit, Arsenic, Chromium, Lead. The dbo.Table_3_Water has the following columns: Boring, sample_date, sample_id, Unit, Benzene, Ethylbenzene,
Pyrene. The dbo.Table_1_XYcoordinates is a Parent Table. The dbo.Table_2_Soil and the dbo.Table_3_Water are 2 Child Tables. The sample_id is key link for the relationship between the Parent Table and the Child Tables.
Problem #1) How can I print out or export these 3 dbo Tables?
Problem #2) If I right-click on the dbo Table, I see "Start PowerShell" and click on it. I get the following error messages: Warning: Failed to load the 'SQLAS' extension: An exception occurred in SMO while trying to manage a service.
--> Failed to retrieve data for this request. --> Invalid class. Warning: Could not obtain SQL Server Service information. An attemp to connect to WMI on 'NAB-WK-02657306' failed with the following error: An exception occurred in SMO while trying
to manage a service. --> Failed to retrieve data for this request. --> Invalid class. .... PS SQLSERVER:\SQL\NAB-WK-02657306\SQLEXPRESS\Databases\APGriMMRP\Table_1_XYcoordinates> What causes this set of error messages? How can
I get this problem fixed in my PC that is an end user of the Windows 7 LAN System? Note: I don't have the regular version of Microsoft Visual Studio 2012 in my PC. I just have the Microsoft 2012 Shell (Integrated) program in my PC.
Problem #3: I plan to create an XML Schema Collection in the "APGriMMRP" database for the Parent Table and the Child Tables. How can I handle the relationship between the Parent Table and the Child Table in the XML Schema Collection?
Problem #4: I plan to extract some results/data from the Parent Table and the Child Table by using XQuery. What kind of JOIN (Left or Right JOIN) should I use in the XQuerying?
Please kindly help, answer my questions, and advise me how to resolve these 4 problems.
Thanks in advance,
Scott ChangIn the future, I would recommend you to post your questions one by one, and to the appropriate forum. Of your questions it is really only #3 that fits into this forum. (And that is the one I will not answer, because I have worked very little with XSD.)
1) Not sure what you mean with "print" or "export", but when you right-click a database, you can select Tasks from the context menu and in this submenu you find "Export data".
2) I don't know why you get that error, but any particular reason you want to run PowerShell?
4) If you have tables, you query them with SQL, not XQuery. XQuery is when you query XML documents, but left and right joins are SQL things. There are no joins in XQuery.
As for left/right join, notice that these two are equivalent:
SELECT ...
FROM a LEFT JOIN b ON a.col = b.col
SELECT ...
FROM b RIGHT JOIN a ON a.col = b.col
But please never use RIGHT JOIN - it gives me a headache!
There is nothing that says that you should use any of the other. In fact, if you are returning rows from parent and child, I would expect an inner join, unless you want to cater for parents without children.
Here is an example where you can study the different join types and how they behave:
CREATE TABLE apple (a int NOT NULL PRIMARY KEY,
b varchar(23) NOT NULL)
INSERT apple(a, b)
VALUES(1, 'Granny Smith'),
(2, 'Gloster'),
(4, 'Ingrid-Marie'),
(5, 'Milenga')
CREATE TABLE orange(c int NOT NULL PRIMARY KEY,
d varchar(23) NOT NULL)
INSERT orange(c, d)
VALUES(1, 'Agent'),
(3, 'Netherlands'),
(4, 'Revolution')
SELECT a, b, c, d
FROM apple
CROSS JOIN orange
SELECT a, b, c, d
FROM apple
INNER JOIN orange ON apple.a = orange.c
SELECT a, b, c, d
FROM apple
LEFT OUTER JOIN orange ON apple.a = orange.c
SELECT a, b, c, d
FROM apple
RIGHT OUTER JOIN orange ON apple.a = orange.c
SELECT a, b, c, d
FROM apple
FULL OUTER JOIN orange ON apple.a = orange.c
go
DROP TABLE apple, orange
Erland Sommarskog, SQL Server MVP, [email protected] -
Adding a table to an existing table results in wrong link
This is the code being used to add a table to a report:
private ISCRTable AddLinkTable(ILinkTable linkTable, string sourceTableAlias, ConnectionInfo connectionInfo)
{ // construct a new Table from its name
ISCRTable newTable = new Table();
newTable.ConnectionInfo = connectionInfo.Clone();
newTable.Name = linkTable.LinkTableName;
newTable.Alias = linkTable.LinkTableName + "_ThisIsTheLinkTable" + LinkTableId++;
if (_dataServiceSettings.DataProvider == DataProvider.Oracle11G)
newTable.QualifiedName = _dataServiceSettings.DatabaseUserName.ToUpper() + "." + newTable.Name.ToUpper();
else
newTable.QualifiedName = "dba." + newTable.Name;
// add a field to this new Table
newTable.DataFields.Add(AddDbField(linkTable.DataField, newTable.Alias));
// join this table to another one named sourceTableAlias, using linkFields TableLink
tableLink = new TableLink();
tableLink.SourceTableAlias = sourceTableAlias;
tableLink.TargetTableAlias = newTable.Alias;
tableLink.JoinType = CrTableJoinTypeEnum.crTableJoinTypeEqualJoin;
Strings sourceFields = new Strings();
Strings targetFields = new Strings();
for (int i = 0; i + 1 < linkTable.LinkFields.Length; i += 2)
sourceFields.Add(linkTable.LinkFields[i]); targetFields.Add(linkTable.LinkFields[i + 1]);
tableLink.SourceFieldNames = sourceFields;
tableLink.TargetFieldNames = targetFields;
TableLinks tableLinks = new TableLinks();
tableLinks.Add(tableLink); _report.ReportClientDocument.DatabaseController.AddTable(newTable, tableLinks);
_report.ReportClientDocument.DatabaseController.VerifyTableConnectivity(newTable);
//AddFieldToReport("{" + newTable.Alias + "." + linkTable.DataField + "}");
return newTable;
This is the resulting query SELECT "Article"."ArtId", "Article"."ArtDescr", "ArticleGroup"."AgDescr1", "Article"."ArtPurchLevel", "Article"."ArtMaximum", "Article"."ArtAbc", "Article"."ArtContext", "Article"."ArtPurchPrice", "Article"."ArtServOutUnt", "ArticleSite"."ArtsSitId", "Article"."ArtRecStatus"
FROM (dba.Article "Article" LEFT OUTER JOIN dba.ArticleGroup "ArticleGroup" ON "Article"."ArtAgId"="ArticleGroup"."AgId")
INNER JOIN "10_78_00"."dba"."ArticleSite" "ArticleSite" ON "Article"."ArtId"="ArticleSite"."ArtsPurch" WHERE "Article"."ArtContext"=1 AND ("ArticleSite"."ArtsSitId"='63'
OR "ArticleSite"."ArtsSitId"='64') AND "Article"."ArtRecStatus">=0 ORDER BY "Article"."ArtId"
the link field artspurch is not the field I declared . It happens to be the first column of the table ArticleSite. This seems to be a bug. has anyone ever experienced anything like this?
( Fixed the formatting )
Message was edited by: Don WilliamsHi Henk,
What was the SQL before you added the table?
I reformatted your code but you may want to confirms it correct or simply copy it into Notepad and then paste into this post.
I find the easiest way to confirm is ad the table and joins in CR Designer first and then look at what Debug mode returns using this:
btnReportObjects.Text = "";
string crJoinOperator = "";
foreach (CrystalDecisions.ReportAppServer.DataDefModel.TableLink rasTableLink in rptClientDoc.DataDefController.Database.TableLinks)
//get the link properties
btnCount.Text = "";
int y = rptClientDoc.DataDefController.Database.TableLinks.Count;
btnCount.Text = y.ToString();
string crJoinType = "";
if (rasTableLink.JoinType == CrTableJoinTypeEnum.crTableJoinTypeAdvance)
crJoinType = "-> Advanced ->";
if (rasTableLink.JoinType == CrTableJoinTypeEnum.crTableJoinTypeEqualJoin)
crJoinType = "-> = ->";
if (rasTableLink.JoinType == CrTableJoinTypeEnum.crTableJoinTypeGreaterOrEqualJoin)
crJoinType = "-> >= ->";
if (rasTableLink.JoinType == CrTableJoinTypeEnum.crTableJoinTypeGreaterThanJoin)
crJoinType = "-> > ->";
if (rasTableLink.JoinType == CrTableJoinTypeEnum.crTableJoinTypeLeftOuterJoin)
crJoinType = "-> LOJ ->";
if (rasTableLink.JoinType == CrTableJoinTypeEnum.crTableJoinTypeLessOrEqualJoin)
crJoinType = "-> <= ->";
if (rasTableLink.JoinType == CrTableJoinTypeEnum.crTableJoinTypeLessThanJoin)
crJoinType = "-> < ->";
if (rasTableLink.JoinType == CrTableJoinTypeEnum.crTableJoinTypeNotEqualJoin)
crJoinType = "-> != ->";
if (rasTableLink.JoinType == CrTableJoinTypeEnum.crTableJoinTypeOuterJoin)
crJoinType = "-> OJ ->";
if (rasTableLink.JoinType == CrTableJoinTypeEnum.crTableJoinTypeRightOuterJoin)
crJoinType = "-> ROJ ->";
textBox1 = "Only gets Link type:" + rasTableLink.SourceTableAlias.ToString() + "." + rasTableLink.SourceFieldNames[0].ToString() +
crJoinOperator + "." + crJoinType + rasTableLink.TargetTableAlias.ToString() + "." + rasTableLink.TargetFieldNames[0].ToString() + "\n";
btnReportObjects.Text += textBox1;
btnReportObjects.AppendText(" 'End' \n");
There are some join types RAS is not capable of.
Attach the report before and after you manually add the join and I'll see if I can get it to work also.
Don
( PS - use the Advanced option to attach files and rename the reports to *.txt. ) -
SQL, PL/SQL functions, and ORA-04091 table is mutating
Dears,
Recently a question came up in an Oracle French forum about an insert/select that is throwing ORA-04091: table xxxx is mutating, trigger/function may not see it error in 11g while the same insert/select was working very well in 10g. The original poster gave a scenario that is easily reproducible. I am wondering what database release is correct the one throwing the error(11g) or the other one accepting the insert/select(10g)?
*10g*
mhouri.world > select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for Solaris: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
mhouri.world > create table t_read_consistency (id number, vc varchar2(15), primary key (id));
Table created.
mhouri.world > insert into
2 t_read_consistency
3 select
4 rownum id,
5 rpad('a',15,'a')
6 from
7 dual
8 connect by
9 level<=1000;
1000 rows created.
mhouri.world > commit;
Commit complete.
mhouri.world > create or replace function f_read_consistency return varchar2
2 as
3 lv_vc t_read_consistency.vc%type;
4 begin
5 select trc.vc
6 into lv_vc
7 from t_read_consistency trc
8 where trc.id = 70 ;
9 return lv_vc;
10 end f_read_consistency;
11 /
Function created.
mhouri.world >insert into
2 t_read_consistency (id, vc)
3 select
4 1001
5 ,f_read_consistency
6 from dual;
,f_read_consistency
ERROR at line 5:
ORA-04091: table MHOURI.T_READ_CONSISTENCY is mutating, trigger/function may not see it
ORA-06512: at "MHOURI.F_READ_CONSISTENCY", line 5
_11g_
mohamed@mhouri> select * from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
mohamed@mhouri> create table t_read_consistency (id number, vc varchar2(15), primary key (id));
Table created.
mohamed@mhouri> insert into
2 t_read_consistency
3 select
4 rownum id,
5 rpad('a',15,'a')
6 from
7 dual
8 connect by
9 level<=1000;
1000 rows created.
mohamed@mhouri> create or replace function f_read_consistency return varchar2
2 as
3 lv_vc t_read_consistency.vc%type;
4 begin
5 select trc.vc
6 into lv_vc
7 from t_read_consistency trc
8 where trc.id = 70 ;
9 return lv_vc;
10 end f_read_consistency;
11 /
Function created.
mohamed@mhouri> insert into
2 t_read_consistency (id, vc)
3 select
4 1001
5 ,f_read_consistency
6 from dual;
,f_read_consistency
ERROR at line 5:
ORA-04091: table MOHAMED.T_READ_CONSISTENCY is mutating, trigger/function may
not see it
ORA-06512: at "MOHAMED.F_READ_CONSISTENCY", line 5 So far so good. Same behaviour for both releases. But let's bring a small change to the PL/SQL function to be as close as the example given in the French Forum
_10g where the select/insert was working without error_:
mhouri.world > select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for Solaris: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
mhouri.world > create type t_read_cs as object (id number,vc varchar2(15));
2 /
Type created.
mhouri.world > create type t_read_cs_tab as table of t_read_cs;
2 /
Type created.
mhouri.world > create or replace function f_read_consistency_tab
2 return t_read_cs_tab
3 as
4 lc_t_read_cs_tab t_read_cs_tab := t_read_cs_tab();
5 j binary_integer := 0;
6 begin
7 for x in (select
8 id,
9 vc
10 from t_read_consistency trs
11 where trs.id <= 10
12 ) loop
13
14 j := j +1;
15 lc_t_read_cs_tab.extend;
16 lc_t_read_cs_tab(j) := t_read_cs(x.id, x.vc);
17 end loop;
18 RETURN lc_t_read_cs_tab;
19 end f_read_consistency_tab;
20 /
Function created.
mhouri.world > select count(1) from t_read_consistency;
COUNT(1)
1000
mhouri.world > select count(1)
2 from (select * from table(f_read_consistency_tab));
COUNT(1)
10
mhouri.world > insert into t_read_consistency
2 (id,vc)
3 select id,vc
4 from table(f_read_consistency_tab)
5 ;
10 rows created.
mhouri.world > select count(1) from t_read_consistency;
COUNT(1)
1010
_11g where the same insert/select is throwing an error:_
mohamed@mhouri> select * from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
mohamed@mhouri> create type t_read_cs as object (id number,vc varchar2(15));
2 /
Type created.
mohamed@mhouri> create type t_read_cs_tab as table of t_read_cs;
2 /
Type created.
mohamed@mhouri> create or replace function f_read_consistency_tab
2 return t_read_cs_tab
3 as
4 lc_t_read_cs_tab t_read_cs_tab := t_read_cs_tab();
5 j binary_integer := 0;
6 begin
7 for x in (select
8 id,
9 vc
10 from t_read_consistency trs
11 where trs.id <= 10
12 ) loop
13
14 j := j +1;
15 lc_t_read_cs_tab.extend;
16 lc_t_read_cs_tab(j) := t_read_cs(x.id, x.vc);
17 end loop;
18 RETURN lc_t_read_cs_tab;
19 end f_read_consistency_tab;
20 /
Function created.
mohamed@mhouri> select count(1) from t_read_consistency;
COUNT(1)
1000
mohamed@mhouri> select count(1) from (select * from table(f_read_consistency_tab));
COUNT(1)
10
mohamed@mhouri> insert into t_read_consistency
2 (id,vc)
3 select id,vc
4 from table(f_read_consistency_tab)
5 ;
from table(f_read_consistency_tab)
ERROR at line 4:
ORA-04091: table MOHAMED.T_READ_CONSISTENCY is mutating, trigger/function may
not see it
ORA-06512: at "MOHAMED.F_READ_CONSISTENCY_TAB", line 7 In addition, one of the posters spotted out very judiciously that if we slightly change the definition of the table t_read_consistency in 11g, strangely the insert/select will work correctly in this data base as shown below:
ohamed@mhouri> drop table tr_read_consistency;
Table dropped.
mohamed@mhouri> create table tr_read_consistency
2 as select rownum rn,
3 trs.*
4 from
5 t_read_consistency trs;
Table created.
mohamed@mhouri> insert into tr_read_consistency
2 (rn, id,vc)
3 select rownum, id,vc
4 from table(f_read_consistency_tab);
10 rows created.So is this a regression? or a corrected bug during upgrade?
Thanks in advance
Mohamed HouriI just followed the doc links provided by Tubby, which have 100% Correct answer. See below :
SQL> select * from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
SQL> show user;
USER is "SCOTT"
SQL> create type t_read_cs as object (id number,vc varchar2(15));
2 /
Type created.
SQL> create type t_read_cs_tab as table of t_read_cs;
2 /
Type created.
SQL> create table t_read_consistency (id number, vc varchar2(15), primary key (id));
Table created.
SQL> create or replace function f_read_consistency_tab
2 return t_read_cs_tab
3 as
4 lc_t_read_cs_tab t_read_cs_tab := t_read_cs_tab();
5 j binary_integer := 0;
6 begin
7 for x in (select
8 id,
9 vc
10 from t_read_consistency trs
11 where trs.id <= 10
12 ) loop
13 j := j +1;
14 lc_t_read_cs_tab.extend;
15 lc_t_read_cs_tab(j) := t_read_cs(x.id, x.vc);
16 end loop;
17 RETURN lc_t_read_cs_tab;
18 end f_read_consistency_tab;
19 /
Function created.
SQL> insert into
2 t_read_consistency
3 select
4 rownum id,
5 rpad('a',15,'a')
6 from
7 dual
8 connect by
9 level<=1000;
1000 rows created.
SQL> select count(1) from t_read_consistency;
COUNT(1)
1000
SQL> select count(1) from (select * from table(f_read_consistency_tab));
COUNT(1)
10
SQL> insert into t_read_consistency
2 (id,vc)
3 select id,vc
4 from table(f_read_consistency_tab);
from table(f_read_consistency_tab)
ERROR at line 4:
ORA-04091: table SCOTT.T_READ_CONSISTENCY is mutating, trigger/function may not see it
ORA-06512: at "SCOTT.F_READ_CONSISTENCY_TAB", line 7
SQL> ed
Wrote file afiedt.buf
1 create or replace function f_read_consistency_tab
2 return t_read_cs_tab
3 as
4 lc_t_read_cs_tab t_read_cs_tab := t_read_cs_tab();
5 j binary_integer := 0;
6 PRAGMA AUTONOMOUS_TRANSACTION; <--- This works as documented in 11.2.0.1
7 begin
8 for x in (select
9 id,
10 vc
11 from t_read_consistency trs
12 where trs.id <= 10
13 ) loop
14 j := j +1;
15 lc_t_read_cs_tab.extend;
16 lc_t_read_cs_tab(j) := t_read_cs(x.id, x.vc);
17 end loop;
18 RETURN lc_t_read_cs_tab;
19* end f_read_consistency_tab;
SQL> /
Function created.
SQL> insert into t_read_consistency
2 (id,vc)
3 select id,vc
4 from table(f_read_consistency_tab);
insert into t_read_consistency
ERROR at line 1:
ORA-00001: unique constraint (SCOTT.SYS_C0011307) violated
SQL> drop table t_read_consistency purge;
Table dropped.
SQL> create table t_read_consistency (id number, vc varchar2(15));
Table created.
SQL> insert into
2 t_read_consistency
3 select
4 rownum id,
5 rpad('a',15,'a')
6 from
7 dual
8 connect by
9 level<=1000;
1000 rows created.
SQL> commit;
Commit complete.
SQL> insert into t_read_consistency
2 (id,vc)
3 select id,vc
4 from table(f_read_consistency_tab);
10 rows created.
SQL> commit;
Commit complete.
SQL>So, you have to add only PRAGMA AUTONOMOUS_TRANSACTION; before begin in your function code to avoid ORA-04091 in 11.2.0.1
But, All thanks to Tubby who pointed us to the correct documentation link.
Regards
Girish Sharma
Maybe you are looking for
-
How do I get rid of genii as my search engine
how do I get rid of genii as my search engine
-
VDI 3.1.1. Configuration with 4 Servers
Hello guys, i have an easy question? The costumer have 4 VDI Server. 1 primary and 3 secondary. When I start the vda-db-status i dont see all 4 host. Is this correct? When fail the DB Node 1 going the DB Note to other host? -bash-3.00# /opt/SUNWvda/
-
10.5.6 Update on Mac Pro
I tried to install the Combined Update on my new Mac Pro (4 days old) but it has been stuck on the same screen for the last 8 hours. It says: "Installing 2 items. Configuring Installation." It doesn't seem right that it is on the same screen for that
-
Yes it is updated
-
Hi, I have created the W/Tax type and codes and also created the surcharge now i will create the Educational cess.How to create the educational cess please tell me the path and T.codes.Other thing is in my posting time the amount will be calculated b