Problem of Uncertain no. of columns
Hi,
I have a requirement where I have to insert data into a pre-defined table (with 'x' no. of columns) from dynamically generated SELECT statements (through a proc) . example,
INSERT INTO Table
EXEC Proc
Problem is, that some of those SELECT statements may not have 'x' no. of columns. Any idea will be really helpful.
I have tried some hit and trial but all in vein.
'In Persuit of Happiness' and ..... learning SQL.
Ok. you've two options in that case
1. use a temporary table with same structure as SP output and populate it as below
INSERT #Temp
EXEC Proc...
Now use temp table to fill your table
INSERT YourTable (col1,col2,col3,..)
SELECT Col1,NULL,Col2,...
FROM #Temp
fill missing columns with NULL values
2. use a direct select based on distributed query
INSERT YourTable (Col1,Col2,Col3,..)
Select Col1,NULL,Col2,..
from
OPENROWSET('SQLOLEDB','Data Source=Servername;Trusted_Connection=yes;
Integrated Security=SSPI','Execute yourdbname..Proc')
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs
Similar Messages
-
Problem with JDBC and VARCHAR-Columns
Hi,
i have a problem handling VARCHAR-Columns via JDBC.
I.e. by using the JDBC-components of <SunONE Community Edition Update 1> any attempt to store any other then numeric values (like "0", "01", "999" etc.) in a column of type VARCHAR results in an error.
After entering the string "test" in a JTextArea or JTextField (which is linked by its document to the VARCHAR-column) i will receive:
"java.lang.NumberFormatException: For input string: "st"/For input string: "st". I also tried the javax.sql. rowSet methods like updateString() with the same result.
Are there any knwon issues corresponding to this behaviour?
<b>Configuration details:</b>
<i>JDBC-Driver:</i>
package com.sap.dbtech.jdbc, MaxDB JDBC Driver, MySQL MaxDB, 7.5.1 Build 000-000-002-750 on Java 1.4.2
<i>Database-version:</i>
7.5.00.16 on WindowsXP Pro SP1
<i>JRE:</i>
1.4.1_02
The <i>trace-file</i> only show this statements:
[email protected] (UPDATE NOTARZTEINSATZPROTOKOLL_1 SET NEUROLOGISCHER_ERSTBEFUND = ? WHERE NAP_ID = ? AND EP_ID = ? AND BEMERKUNG IS NULL AND SOZ_ID IS NULL AND PSYZ_ID IS NULL AND ERSTBEFUND_ZEITPUNKT IS NULL AND GCSAO_ID_EB IS NULL AND GCSBVR_ID_EB IS NULL AND GCSBMR_ID_ARMLINKS_EB IS NULL AND GCSBMR_ID_ARMRECHTS_EB IS NULL AND GCSBMR_ID_BEINLINKS_EB IS NULL AND GCSBMR_ID_BEINRECHTS_EB IS NULL AND BWSL_ID_EB IS NULL AND EXTB_ID_ARMLINKS_EB IS NULL AND EXTB_ID_ARMRECHTS_EB IS NULL AND EXTB_ID_BEINLINKS_EB IS NULL AND EXTB_ID_BEINRECHTS_EB IS NULL AND PUPW_ID_LINKS_EB IS NULL AND PUPW_ID_RECHTS_EB IS NULL AND EJN_ID_FEHLTLICHTR_LI_EB IS NULL AND EJN_ID_FEHLTLICHTR_RE_EB IS NULL AND EJN_ID_MENINGISMUS_EB IS NULL AND NEUROLOGISCHER_ERSTBEFUND IS NULL AND TEMPERATUR_EB IS NULL AND RR_SYSTOLISCH_EB IS NULL AND RR_DIASTOLISCH_EB IS NULL AND HERZFREQUENZ_EB IS NULL AND EJN_ID_HF_REGELM_EB IS NULL AND BLUTZUCKER_EB IS NULL AND ATEMFREQUENZ_EB IS NULL AND SPO2_EB IS NULL AND CO2_EB IS NULL AND SCHM_ID_EB IS NULL AND ERH_ID_COR_EB IS NULL AND EELS_ID_COR_EB IS NULL AND EJN_ID_EKG_EMENTKOPPEL_EB IS NULL AND EERBST_ID_COR_EB IS NULL AND EHA_ID_COR_EB IS NULL AND ESVES_ID_COR_EB IS NULL AND EVES_ID_COR_EB IS NULL AND EKG_BEMERKUNG_EB IS NULL AND ATRH_ID_EB IS NULL AND EJN_ID_ZYANOSE_EB IS NULL AND EJN_ID_SPASTIK_EB IS NULL AND EJN_ID_RASSELGER_EB IS NULL AND EJN_ID_STRIDOR_EB IS NULL AND EJN_ID_VERLEGATEMW_EB IS NULL AND BEAM_ID_UEBERNAHME IS NULL AND ATMUNG_FREITEXT_EB IS NULL AND VERLM_ID IS NULL AND SCHWV_ID_SCHAEDELHIRN IS NULL AND SCHWV_ID_GESICHT IS NULL AND SCHWV_ID_HWS IS NULL AND SCHWV_ID_THORAX IS NULL AND SCHWV_ID_ABDOMEN IS NULL AND SCHWV_ID_BWSLWS IS NULL AND SCHWV_ID_BECKEN IS NULL AND SCHWV_ID_OEXTREMITAET IS NULL AND SCHWV_ID_UEXTREMITAET IS NULL AND SCHWV_ID_WEICHTEILE IS NULL AND VBRT_ID IS NULL AND TRT_ID IS NULL AND UHG_ID IS NULL AND SICHTK_ID IS NULL AND UNFALLZEITPUNKT IS NULL AND SAPS_2 IS NULL AND TISS_28 IS NULL AND NACA_ID IS NULL AND ZBV IS NULL )
=> com.sap.dbtech.jdbc.CallableStatementSapDB@11daf60
<at this position the trace-file ends?!; "NEUROLOGISCHER_ERSTBEFUND ist defined as
"NEUROLOGISCHER_ERSTBEFUND" Varchar (1000) ASCII; i also encountered this problem while handling shorter VARCHAR-columns with JComboBox-components...>
Any information would be very helpfully!!!
Greetings,
Arnd
Message was edited by: Arnd Benninghoff
Message was edited by: Arnd BenninghoffHi Arnd,
if I understand right you are trying to insert/update value into a Varchar(1000) column. And if you set a non numeric value you get an exception "java.lang.NumberFormatException", Right?
Of course this should work with MaxDB. The exception you get doesn't come from MaxDB's JDBC driver. The driver will only throw exceptions that are derived from java.sql.Exception.
So, I guess the error comes from a layer above the JDBC layer, possibly from the JDBC-components of <SunONE Community Edition Update 1>. This would also explain why you don't see any exception in the JDBC trace.
Did you have defined any constraints for the input field (JTextArea or JTextField)?
Hope that helps.
regards,
Marco -
Problem with attachtment XLS (last column of the xls)
Hi,
iam working on interface in which i will be sending an email along with attachtment where my email along with attachtment are working perfectly ,the problem is with the XLS where the last column of the XLS is taking 255 char which is the length of the field .
How i have to restrict it ?
solution on this would be helpfull .
Thanks ,
shankar.
I have attached the sample code too.
FUNCTION zemail_send_attachment.
""Local Interface:
*" IMPORTING
*" VALUE(EMAILID)
*" VALUE(SUBJECT)
*" VALUE(ATYPE)
*" TABLES
*" ATTACH_FILE STRUCTURE SOLISTI1
*" BODY OPTIONAL
This table requires information about how the data in the
tables OBJECT_HEADER, CONTENTS_BIN and CONTENTS_TXT are
to be distributed to the documents and its attachments.
DATA objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
This table must contain the summarized data dependent on each object type.
SAPscript objects store information here about forms and styles,
for example. Excel list viewer objects store the number of rows and columns
amongst other things and PC objects store their original file name.
DATA objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
This table must contain the summarized content of the objects identified as binary objects.
DATA objbin TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
This table must contain the summarized content of the objects identified as ASCII objects.
DATA objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.
This table must contain the document recipients.
DATA reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE .
This structure must contain the attributes of the document to be sent.
DATA: doc_ching LIKE sodocchgi1.
DATA: tab_lines LIKE sy-tabix.
Create the internal table for body , subject
DATA: it_body LIKE solisti1 OCCURS 10 WITH HEADER LINE.
CONSTANTS: con_cret TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
con_tab TYPE c VALUE cl_abap_char_utilities=>cr_lf.
Move Body to Internal Table (body into it_body)
LOOP AT body .
MOVE body TO it_body .
APPEND it_body .
ENDLOOP.
doc_ching-obj_descr = subject. "Subject of the Email
Move the Subject and Body to OBJTXT
objtxt[] = it_body[].
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
doc_ching-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'RAW'.
APPEND objpack.
Convert IT to Excel format
IF atype = 'XLS' .
LOOP AT attach_file .
REPLACE ALL OCCURRENCES OF '#' IN attach_file WITH con_cret ."INTO objbin.
IF sy-tabix = 1.
MOVE attach_file TO objbin.
ELSE.
CONCATENATE con_tab attach_file INTO objbin.
ENDIF.
APPEND objbin.
ENDLOOP.
ELSEIF atype = 'TXT' .
Convert IT to Text format
LOOP AT attach_file .
REPLACE ALL OCCURRENCES OF '#' IN attach_file WITH con_cret. " INTO objbin.
CONCATENATE attach_file con_tab INTO objbin .
APPEND objbin .
ENDLOOP.
ENDIF.
DESCRIBE TABLE objbin LINES tab_lines.
objhead = subject. APPEND objhead.
Creating the entry for the compressed attachment
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = 1.
objpack-body_num = tab_lines.
IF atype = 'XLS'.
objpack-doc_type = atype.
ELSEIF atype = 'TXT'.
objpack-doc_type = 'RAW'.
ENDIF.
objpack-obj_name = 'ATTACHMENT'.
objpack-obj_descr = 'TEST'. "Attachment File Name
objpack-doc_size = tab_lines * 255.
APPEND objpack..
reclist-receiver = emailid.
reclist-rec_type = 'U'.
APPEND reclist.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_ching
put_in_outbox = 'X'
commit_work = 'X'
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
receivers = reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99 .
ENDFUNCTION.I had this problem after migrating to JDeveloper 10.1.3. Problem was with inconsistent DB column types. In our case, the DB column was CHAR containing only numbers, but VO defined it as NUMBER. This caused no problem in 9.0.3 we used before.
<ViewAttribute
Name="ParentFlagNew"
IsPersistent="false"
Precision="1"
Type="oracle.jbo.domain.Number"
ColumnType="NUMBER"
AliasName="PARENT_FLAG_NEW"
Expression="PARENT_FLAG_NEW"
SQLType="NUMERIC" >
<Properties>
<Property Name ="DISPLAY_LIST" Value ="1=Yes,0=No" />
<Property Name ="DISPLAY_LIST_sk" Value ="1=Áno,0=Nie" />
<Property Name ="Renderer" Value ="sk.transacty.cm_iface.bc4j_common.ListFieldRenderer" />
</Properties>
<DesignTime>
<Attr Name="_DisplaySize" Value="1" />
</DesignTime>
</ViewAttribute> -
Problem with getLong for a column of type NUMBER
When ever I am calling getLong on a column defined as NUMBER in the database, I get this error message. The number I am retreving is something like '320000000010'..
What could be the problem? Has somebody encountered a
similar problem?
The database is 8.1.7.4 and the JDBC driver is a thin driver.
java.lang.ArrayIndexOutOfBoundsException
at oracle.sql.NUMBER._fromLnxFmt(NUMBER.java:3181)
at oracle.sql.LnxLibThin.lnxsni(LnxLibThin.java:6571)
at oracle.sql.NUMBER.toLong(NUMBER.java:373)
at oracle.sql.NUMBER.longValue(NUMBER.java:2002)
at oracle.jdbc.driver.ScrollableResultSet.getLong(ScrollableResultSet.java:807)
at oracle.jdbc.driver.UpdatableResultSet.getLong(UpdatableResultSet.java:458)
Thanks
RangaI had this problem after migrating to JDeveloper 10.1.3. Problem was with inconsistent DB column types. In our case, the DB column was CHAR containing only numbers, but VO defined it as NUMBER. This caused no problem in 9.0.3 we used before.
<ViewAttribute
Name="ParentFlagNew"
IsPersistent="false"
Precision="1"
Type="oracle.jbo.domain.Number"
ColumnType="NUMBER"
AliasName="PARENT_FLAG_NEW"
Expression="PARENT_FLAG_NEW"
SQLType="NUMERIC" >
<Properties>
<Property Name ="DISPLAY_LIST" Value ="1=Yes,0=No" />
<Property Name ="DISPLAY_LIST_sk" Value ="1=Áno,0=Nie" />
<Property Name ="Renderer" Value ="sk.transacty.cm_iface.bc4j_common.ListFieldRenderer" />
</Properties>
<DesignTime>
<Attr Name="_DisplaySize" Value="1" />
</DesignTime>
</ViewAttribute> -
Problem in displaying the TaxRate columns .
Hi Experts,
I am having a problem in displaying the 'TaxRate', in this Query there are some different Taxrate's columns like- ' 'Basic Excise Duty BED@10 %', ' Education ces@2% ' , 'Secondary Education Cess @1%', etc. only 4 -5 tax's value should display at a time and rest of the TaxRate's columns whose value is NULL should not display.
So, I want to display only those TaxRate's columns whose value is not NULL and If there is no value for any taxrate's column in the data, then it should Display only 'Excempt' column.
This is my query...
SELECT DISTINCT OSTA.Code , ORPC.DocNum AS 'Debit Note No.', ORPC.CardName AS 'Name', ORPC.CardCode AS 'code', ORPC.NumAtCard AS 'Supplier Ref.' ,
RPC1.Dscription AS 'Description of Goods', ORPC.Address, RPC1.Quantity, RPC1.Price AS 'Rate', RPC1.LineTotal AS 'Amount', ORPC.DocDate,
(SELECT DISTINCT TaxRate
FROM RPC4
WHERE (staType = - 90) AND (StaCode = 'BED@10') AND (DocEntry = RPC1.DocEntry)) AS 'Basic Excise Duty BED@10 %',
(SELECT DISTINCT TaxRate
FROM RPC4 AS RPC4_8
WHERE (staType = - 60) AND (DocEntry = RPC1.DocEntry)) AS 'Education Cess @2%',
(SELECT DISTINCT TaxRate
FROM RPC4 AS RPC4_7
WHERE (staType = - 55) AND (DocEntry = RPC1.DocEntry)) AS 'Secondary Education Cess @1%',
(SELECT DISTINCT TaxRate
FROM RPC4 AS RPC4_6
WHERE (staType = 4) AND (StaCode = 'CST2') AND (DocEntry = RPC1.DocEntry)) AS 'Central Sales Tax(CST)',
(SELECT DISTINCT TaxRate
FROM RPC4 AS RPC4_5
WHERE (staType = 1) AND (StaCode = 'VAT4') AND (DocEntry = RPC1.DocEntry)) AS 'Input VAT@5%',
(SELECT DISTINCT TaxRate
FROM RPC4 AS RPC4_4
WHERE (staType = 1) AND (TaxRate = 12.500000) AND (StaCode = 'VAT12.5') AND (DocEntry = RPC1.DocEntry)) AS 'VAT12.5%',
(SELECT DISTINCT TaxRate
FROM RPC4 AS RPC4_3
WHERE (staType = 18) AND (StaCode = 'Add2') AND (DocEntry = RPC1.DocEntry)) AS 'ADD Tax 1%',
(SELECT DISTINCT TaxRate
FROM RPC4 AS RPC4_2
WHERE (staType = 7) AND (DocEntry = RPC1.DocEntry)) AS 'Excempt'
FROM OSTA INNER JOIN
RPC4 AS RPC4_1 ON OSTA.Code = RPC4_1.StaCode CROSS JOIN
ORPC INNER JOIN
RPC1 ON ORPC.DocEntry = RPC1.DocEntry
WHERE (OSTA.Code IN ('BED@10','eCess 2%','HeCess 1%','CST')) AND (ORPC.CardCode = 'V00308') AND (ORPC.DocNum = '9220004')
Kindly help me to solve this problem
Regards
RahulHi rahul,
Try this:
SELECT DISTINCT T0.DocNum AS 'Debit Note No.', T0.CardName AS 'Name', T0.CardCode AS 'code', T0.NumAtCard AS 'Supplier Ref.'
,T1.Dscription AS 'Description of Goods', T0.Address, T1.Quantity, T1.Price AS 'Rate', T1.LineTotal AS 'Amount', T0.DocDate,
(SELECT DISTINCT ISNULL (SUM(RPC4.TaxRate),0)FROM RPC4 WHERE RPC4.StaType = -90 AND RPC4.DocEntry = T0.DocEntry) AS 'Basic Excise Duty BED@10 %',
(SELECT DISTINCT ISNULL (SUM(RPC4.TaxRate),0) FROM RPC4 WHERE RPC4.StaType = -60 AND RPC4.DocEntry = T0.DocEntry) AS 'Education Cess @2%',
(SELECT DISTINCT ISNULL (SUM(RPC4.TaxRate),0) FROM RPC4 WHERE RPC4.StaType = -55 AND RPC4.DocEntry = T0.DocEntry) AS 'Secondary Education Cess @1%',
(SELECT DISTINCT ISNULL (SUM(RPC4.TaxRate),0) FROM RPC4 WHERE RPC4.StaType = 4 AND RPC4.StaCode = 'CST2' AND RPC4.DocEntry = T0.DocEntry) AS 'Central Sales Tax(CST)',
(SELECT DISTINCT ISNULL (SUM(RPC4.TaxRate),0) FROM RPC4 WHERE RPC4.StaType = 1 AND RPC4.StaCode = 'VAT4'AND RPC4.DocEntry = T0.DocEntry) AS 'Input VAT@5%',
(SELECT DISTINCT ISNULL (SUM(RPC4.TaxRate),0) FROM RPC4 WHERE RPC4.StaType = 1 AND RPC4.StaCode = 'VAT12.5'AND RPC4.DocEntry = T0.DocEntry) AS 'VAT12.5%',
(SELECT DISTINCT ISNULL (SUM(RPC4.TaxRate),0) FROM RPC4 WHERE RPC4.StaType = 18 AND RPC4.StaCode = 'Add2'AND RPC4.DocEntry = T0.DocEntry) AS 'ADD Tax 1%',
(SELECT DISTINCT ISNULL (SUM(RPC4.TaxRate),0) FROM RPC4 WHERE RPC4.StaType = 7 AND RPC4.DocEntry = T0.DocEntry) AS 'Excempt'
FROM ORPC T0
INNER JOIN RPC1 T1 ON T0.DocEntry = T1.DocEntry
WHERE (T0.CardCode = 'V00308') AND (T0.DocNum = '9220004')
FOR BROWSE
Thanks,
Neetu -
Problem inserting value in CLOB column from an XML file using XSU
Hi,
When I try to insert CLOB value into Oracle9i database from an XML document using XSU, I get an exception as below.
09:37:32,392 ERROR [STDERR] oracle.xml.sql.OracleXMLSQLException: 'java.sql.SQLException: ORA-03237: Initial Extent of specified size cannot be allocated
ORA-06512: at "SYS.DBMS_LOB", line 395
ORA-06512: at line 1
' encountered during processing ROW element 0. All prior XML row changes were rolled back. in the XML document.
All Element tags in XML doc. is mapped to columns in the database. One of the table columns is CLOB. That is the one that gives the above exception. Here is the xml...
ID - is autogenerated value.
<?xml version="1.0" ?>
<ROWSET>
<ROW num="1">
<ID></ID>
<SEQ>
GCATAGTTGTTATGAAGAAATGGAAGAAAAATGCACTCAAAGTTGGGCTGTCAGGCTGTCTGGGGCTGAATTCTGGTGTGACAGTGTGATGAAGCCATCTTTGAGCCTAAATTTGATAATGAGCCAGTCATGATCTGGTTGTGATTACTATAACAAGATTAAATCTGAATAAGAGAGCCACAACTTCTTTAAAGACAGATTGTCAAGTCATTACATGGAAGAGGGAGATTGCTCCTTTGTAAATCAGGCTGTCAGGCCAACTGAATGAAGGACGTCATTGTACAGTAACCTGATGAAGATCAGATCAACCGCTCACCTCGCCG
</SEQ>
</ROW>
</ROWSET>
Can anyone identify what's the problem.. and suggest a solution for this..?
Thanks in advance..
VijiWould you please specify the XDK verison and database version?
-
Problem with Mail, and Placceholder Columns in Report 2.5
I have two problem with Developer/2000 Report 2.5:
1. What should I configure in order my Report 2.5 can
mail the report output to Microsoft Mail or MS Exchange ?
2. Placeholder Columns have an Edit PL/SQL code as Formula
columns. But when I fill the trigger at Placeholder columns
there always some error. I never know the functions of
trigger at placeholder columns. is it a bug at Report 2.5 ?,
if not please tell me how can I use the placeholder
columns trigger ?
Thank you.
Herry H.S.
nullI found out the problem... not a problem at all... thank you...
-
Problem creating a datablock with columns from 2 tables...
Hello guys, i have a problem in creating a datablock with columns from 2 different tables. I try to create the datalock manually and in the Query Data Source Type Property i choose FROM clause query, and in the query data source name property i type my sql statement with the columns i want to display.After that i place the items that the datablock will contain , manually from the painter. However , when i run the application, the datablock doesn't display the items from the database. Am i doing something wrong?
Thanx in advance,
Regards,
Bill.Never mind Peter, I found the error. I forgot to make execute_query for the datablock, so this was the reason why the items weren't displayed to me.
Thanx anyway a lot for your advices and your time you spent ! -
Anyone have a problem with the number of columns in a webform in 11.1.2?
We are converting apps from 9.3 and have discovered a problem when an unspecified error occurs when trying to pull out a web form with more than 125 columns. The form works in 9.3 and loads without error in 11.1.2 . However when its run in the new version it fails with an unspecified arror. The columns are a list of base accounts. If this is broken down between the base accounts of the immediate children of the specified account then each group works properly, but if it's the base of the specified account or the base of the children of the specified account each on a separate column definition then the error occurs. Has anyone come accross this before, or is there a new (undocumented) parameter relating to columns like MaxCells?
Just to clarify: if the columns are 125 then the form works properly, if it's 126 columns then the error is generated, and it happens immediately the form is run.
Edited by: MikeWesley on 21-Jul-2011 03:53Try copying and pasting the script of the report from the old verison into a new report in 11.1.2 instead of importing the report
-
Table editor problem with default value for column
Hi there,
I'm trying to use SQL Developer 1.2.1 on Ubuntu 7.10 (though I don't think the OS is relevant) and I'm running into a snag when trying to update table structures. If you go to edit the table to say modify a column name, and that column has a default value set, SQL Developer is encapsulating the value with brackets and quotes. When trying to save the changes, it complains about the default value being 4 chars too many for the column width. An example of this would be a currency code column of varchar2 (3) set with EUR as the default. SQL Developer changes the value to ('EUR') hence the error.
Is there anyway to prevent this from happening?
Cheers,
ChrisCould you please be more specific? In 1.2.1.32.40 I
added the column COL1 VARCHAR2(3) with default value
'EUR'. The data display field refreshed to show the
default value, so I edited it in a couple of entries
and comitted the change without problem. Then I
renamed the column from the "Edit table" popup menu.
Finally, I renamed the column from the "Rename
column" popup menu, no problem either.Ah, you are correct. That does work. What I was trying is select tablename in the object browser, then right click on it and select "Edit" from the contextual menu. You are then presented with edit table dialog box. If you then select a column in that box you will see a column properties box. In that section you can change the name, default value, datatype et cetera. Note that your default column value which should just be EUR (or 'EUR' to denote that it's a string) is now ('EUR'). Once you try changing the name to of the column to something else and then click OK, you should then get an error complaining of "Invalid varchar2 default value" with a more specific message of "Default values size 7 is greater than the allowed 3"
You have provided a work around, and thanks for that, but it would be nice to edit everything in the Edit table dialog box if you're modifying more than one column name. I'm tasked with cleaning up a bit of a messy database, and there are a good deal of columns to be renamed.
Cheers,
Chris -
Problem displaying oracle.sql.timestamp columns
When displaying table contents using the editor, column values of type oracle.sql.timestamp show up as "<error>". In the "SQL Results" window, for colunms of this type, the column value shows only "oracle.sql.TIMESTAMP. Does anyone know if there is a fix for this problem. Thanks. -Chuck
I've had the same problem, I would think that there would be support for JDBC time with a timezone. -Derek
-
Sum problem of rows because of column
Problem...
I have 2 row groups
Year and QTY
for every Year (2003,2004 etc) there are a number of cities with their own QTY
For instance
City1 has QTY = 20 for Year 2003
City2 has QTY = 30 for Year 2003
When I sum only one City1 I want the column QTY to show 20 for Year 2003 and to show 50 if both City1 and City2 are selected.
The problem is when I sum let say City 1 it shows me 100 instead of 20 because the column group consists of 5 rows in dataset query with QTY 20, so if I sum 2 cities of the same Year it will give me 100(City1) + X(City2).
Did it make sense or do you need more input?Hi Jhonny86,,
According to your description, you want to sum the [Qty] values for based on the selected values in the parameter.
In your scenario, you can use DISTINCT keyword to return only distinct (different) values in query designer. Then create a tablix group on [Year] and create a city parameter. Please refer to screenshots below:
If report deisgn above doesn't meet your requirements, please share sample data and expected results for our analysis.
If you have any question, please feel free to ask.
Best regards,
Qiuyun Yu
Qiuyun Yu
TechNet Community Support -
AdvancedDataGrid problem with programmatically adding a column
Hi everybody,
I have a Problem with adding columns programmatically to a AdvancedDataGrid. The code:
var cols:Array = thisDataGrid.columns;
cols.push(dgc);
thisDataGrid.columns = cols;
does create a column, adds it to the cols array, bot the last code line has no effect. The cols wont be found in the thisDataGrid.columns property...
What could be the problem? I'm working with a test license, and on the advanceddatagrid the watermark shows up. Could this be a problem?
Thanks for help!
MarkusAs the columns property of an adg is bindable, you could try to bind it to an array and afterwards, add columns to that array:
AS:
[Bindable]
private var adgCols:Array = new Array();
private function addCol():void
var myCol:AdvancedDataGridColumn = new AdvancedDataGridColumn();
myCol.headerText = "test";
myCol.dataField = "v1";
adgCols.push(myCol);
MXML:
<mx:AdvancedDataGrid id="adg" designViewDataType="flat" columns="{adgCols}"/>
This helps?
Dany -
Performance problem on view with spatial column - resolved
I have had a problem with queries on a view that had a spatial column, where the view did not belong to the logged in user. Where my spatial window was retrieved by a sub-query, the spatial scan did a full table scan instead of using the spatial index.
I have found that the problem can be resolved by granting MERGE VIEW on the view to the querying user.
The view can be as simple as SELECT * FROM table.
The badly performing query could be as simple as
select id from T1.tstview
where SDO_RELATE(coordinates,
(SELECT coordinates FROM T1.tstWINDOW WHERE ID = '1')
,'mask=INSIDE+COVEREDBY querytype=WINDOW') = 'TRUE' ;
I think this is a bug, and have raised an SR - MERGE VIEW is supposed to override issues with the "security intent" of a view.
The workaround is simple enough once you're aware of it and I thought it was worth passing on.Thanks for sharing this workaround!
Which ORACLE version did you test ? -
Problems with inserted datagridview checkbox column
I have a few problems with a checkbox column added to a datagridview. The datagridview is bound by a binding source whose datasource is a datatable. I also add in the code a checkbox column:
private
void InitializeDataGridView()
dgvInvoices.ColumnHeadersDefaultCellStyle.Font =
new Font("Arial", 10,
FontStyle.Bold);
DataGridViewCheckBoxColumn chkColumn =
new DataGridViewCheckBoxColumn();
chkColumn.FlatStyle =
FlatStyle.Standard;
dgvInvoices.Columns.Insert(0, chkColumn);
dgvInvoices.DataSource = bs;
cmbInvoicingCriteria.Text =
"(All)";
DataGridViewBinding.CreateColumn(dgvInvoices,
"Date", "Date",
DataGridViewContentAlignment.MiddleLeft);
DataGridViewBinding.CreateColumn(dgvInvoices,
"Invoice", "Invoice",
DataGridViewContentAlignment.MiddleLeft);
DataGridViewBinding.CreateColumn(dgvInvoices,
"Customer", "Customer");
DataGridViewBinding.CreateColumn(dgvInvoices,
"Name", "Name");
DataGridViewBinding.CreateColumn(dgvInvoices,
"Count", "Count");
DataGridViewBinding.CreateColumn(dgvInvoices,
"Total", "Total");
DataGridViewBinding.CreateColumn(dgvInvoices,
"Driver", "Driver");
DataGridViewBinding.CreateColumn(dgvInvoices,
"Status", "Status");
DataGridViewBinding.CreateColumn(dgvInvoices,
"ARHID", "ARHID");
DataGridViewBinding.CreateColumn(dgvInvoices,
"AR", "AR");
dgvInvoices.Columns["ARHID"].Visible =
false;
dgvInvoices.Columns["AR"].Visible =
false;
this.dgvInvoices.Columns[0].DefaultCellStyle.Font =
new Font("Arial", 18,
FontStyle.Bold);
this.dgvInvoices.Columns["Date"].DefaultCellStyle.Font =
new Font("Arial", 10,
FontStyle.Bold);
this.dgvInvoices.Columns[2].DefaultCellStyle.Font =
new Font("Arial", 10,
FontStyle.Bold);
this.dgvInvoices.Columns["Customer"].DefaultCellStyle.Font =
new Font("Arial", 10,
FontStyle.Bold);
this.dgvInvoices.Columns["Name"].DefaultCellStyle.Font =
new Font("Arial", 10,
FontStyle.Bold);
this.dgvInvoices.Columns["Count"].DefaultCellStyle.Font =
new Font("Arial", 10,
FontStyle.Bold);
foreach (DataGridViewColumn dc
in dgvInvoices.Columns)
dc.ReadOnly =
true;
if (dc.HeaderText.ToLower() ==
"count" || dc.HeaderText.ToLower() ==
"name" || dc.Index == 0)
this.dgvInvoices.Columns[dc.Index].AutoSizeMode =
DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
else
this.dgvInvoices.Columns[dc.Index].AutoSizeMode =
DataGridViewAutoSizeColumnMode.Fill;
dgvInvoices.DefaultCellStyle.Alignment =
DataGridViewContentAlignment.MiddleCenter;
dgvInvoices.Columns[0].ReadOnly =
false;
dgvInvoices.Columns[0].Width = 25;
dgvInvoices.Columns[0].SortMode =
DataGridViewColumnSortMode.Automatic;
The problems I have here are
1. The first checkbox doesn't check off (it used to work when the width was 25 but then I added the code ontop to make the autosize mode of this columns to allcellscellsexcept header it stopped working. I need that though because if I don't make the autosizemode
= all cells except header then when I make the form narrow the checkbox column disappears.) I was wondering why this is happening, and how to fix it.
2. Also this column is not sortable. I added to my code dgvInvoices.Columns[0].SortMode = DataGridViewColumnSortMode.Automatic;
but it doesn't seem to work.
3. Whenever I sort another column the checked off checkboxes lose their focus. I understand that can be a problem with a bound datagridview and one unbound column, but how can I fix it?
Debra has a questionI loaded the data for all the rows from a datatable on the form. The checkbox column is that connected to that bound data. it's just there and I need to be able to tell if each row was checked or not, and I need to be able to sort the checkbox column. I
also need to be able to sort all the other columns without losing the check. The only thing commenting out the foreach would help would be that the first checkbox can be checked, but I want it to be autosizemode = allcellsexceptheader and I want to understand
why it's not working like this. Would you have any ideas? Below is how I bound the datagridview for all columns except the checkbox column.
private
void LoadDataGridView()
DataGridViewBinding.BindWithData(false, dsInvoicingFilter.Tables[0], dgvInvoices, lblEntryCount, bs);
if (dsInvoicingFilter.Tables[0].Rows.Count == 0)
btnDelete.Enabled =
false;
btnOpenInvoice.Enabled =
false;
btnPrint.Enabled =
false;
btnSaveAsInvoice.Enabled =
false;
btnVoid.Enabled =
false;
btnShip.Enabled =
false;
else
btnDelete.Enabled =
true;
btnOpenInvoice.Enabled =
true;
btnPrint.Enabled =
true;
btnSaveAsInvoice.Enabled =
true;
btnVoid.Enabled =
true;
btnShip.Enabled =
true;
bs.Position = 0;
dgvInvoices.Columns[0].Width = 25;
txtSearch.Text =
public static
void BindWithData(bool autoGenerateColumns,
DataTable datatable,
DataGridView datagridview, Label lblDGVEntryCount,
BindingSource bs)
datagridview.AutoGenerateColumns = autoGenerateColumns;
bs.DataSource = datatable;
datagridview.DataSource = bs;
DataGridViewEntryCount(datagridview, lblDGVEntryCount);
//ExpandColumns(datagridview);//to do it slows it down. Why can't the dgv remember to do it from when initialized it?
Debra has a question
Maybe you are looking for
-
Video out from G5 to DSR-45 to monitor
I use a SONY DSR-45 to dump footage into my Mac. I also firewire back out TO the DSR-45 and then S-video to a 14" SONY Monitor to view during editing. The problem is I lost connection to the monitor. it has to be a software setting as I can play tape
-
I have one of the oriignal IPOD's circo 2006. I've got about 150 tunes on it which has been fine but today tried to add another 200 or so and was advised I need about 848 MB to load them. Is there any solution. I have 2 playlists. One with the o
-
I have been using this for as long as the feature has been available along with App tabs. All of a sudden it no longer works. I have tried resetting the option to something else and then back again. I've also tried reloading and reinstalling Firefox.
-
5770 and 5870 in Mac Pro 2009 - noisy PCIe expansion bay fan
I replaced the Geforce GT120 by the ATI radeon 5770 in my Mac Pro Quad 2.66 Nehalem. I had severe trouble with the speed of the fan of the PCI-e expansion bay: 2000 RPM and really noisy. After 30-60 minutes it slowed down and became silent, but upon
-
How To Earmark Non-English email as Junk?
For some reason, for a long time I have been getting many spams every day that are in Portugese. I would like to create a rule in Mail to automatically move all email that is in Portugese (or in any language other than English) into my Junk folder. I