Get an empty result set but not null
Hello
I try to get all the rows in a table, it's inside a database to ORACLE 10 g using JRE 1.5.
The connection is made.
When I do executequery, it works well (whitout exceptions), the problem is that I'm a non-null result set, but it is empty.
When I run the query directly in SQLDeveloper, sqlplus and TOAD he recover 12 rows, in this case I did not error in the search criteria and the query syntax is correct.
Please helpme with a few suggestions or references.
CRGM
Your the log output does not show this line
>
If (rs! = null) {}
System.out.println ("CRGM: is not null" "");
>
You said initially
>
the problem is that I'm a non-null result set, but it is empty
>
But if it was true we output the log to the top line.
Tags: Oracle
Similar Questions
-
Cannot read e-mail messages Hotmail, I get the frame of page but not the text of the E-mail
Dear anyone.
Since May 4, I was unable to read Hotmail emails in Firefox, I had to download Google Chrome just to read emails (yuck!) Before May 4, everything was fine. Now, I get the page frame, i.e. the part that said Hotmail to the top my list of Email subfolders to the bottom of the left side and the text of Microsoft on the bottom. The central area, which must contain the text of the may E real (and graphics of course if there is) is empty. I tried clear the cache and history, clear cookies, just like that, no joy.
What has been the change suddenly from Hotmail, which has caused this? It is NOT a change in Firefox that I have not changed my version and it worked perfectly until today, may 4.
Your puzzledly
ulrichburke
Sorry to disappoint you, but I'm a man. But thank you for your comment.
Could you please mark this issue as RESOLVED for other users can come here to get the solution?
Thank you.
-
vShield tab is empty for me but not for others. Do you think things are correctly defined
I have a weird. In vsphere client (desktop) when I click on the tab my vshiled I get the original certificate screen. However, after accepting the screen remains empty. He appeared for a few minutes yesterday, but does nothing for me now. However, it does not for others in society, same network segment, etc...
The settings of your client may be...
Something to think off:
-Disable the enhanced security of Internet
-Add your vCenter to the trust box in your browser
-Lower the security settings, etc.
I think that something you can't see the screen properly.
-
How to get some of the files, but not all of them in a query
Hi I have a query that returns events that do not have the mrreceived as 'Y '. I'm trying to find a way how we can rewrite the query which gives the events without mrreceived as "Y" or mrreceived as null but events both on the handset? "
{code}
Select c.client_id,
e.event_id,
e.mrreceived,
e.event_status_code,
e.proj_batch_id,
p.ProviderName,
p.clientproviderid
the event e, customer c, slip p
where e.client_id = c.client_id
and e.clientproviderid = p.clientproviderid
and c.client_id = 1250
and p.clientproviderid not in
(select distinct sliding b.clientproviderid b, event x
where b.clientproviderid = p.clientproviderid
and b.clientproviderid = x.clientproviderid
and x.mrreceived = 'Y '.
and e.client_id = 1250)
{code}user11961230 wrote:
I just want to see the id 10371.
Ok. If you want to see id with both Y and NULL, right? If so:
select c.client_id, e.event_id, e.mrreceived, e.event_status_code, e.proj_batch_id, p.providername, p.clientproviderid from event e, client c, clientprovider p where e.client_id = c.client_id and e.clientproviderid = p.clientproviderid and c.client_id = 1250 and p.clientproviderid in (select b.clientproviderid from clientprovider b, event x where b.clientproviderid = p.clientproviderid and b.clientproviderid = x.clientproviderid and (x.mrreceived = 'Y' or x.mrreceived IS NULL) and e.client_id = 1250 group by b.clientproviderid having count(distinct nvl(x.mrreceived,'X')) = 2 ) /
SY.
-
I keep getting install on Windows 7, but not Windows XP errors
Original title: installation problem
I, I'll try WinXP installation corei3 but system has an error against the installation of win 7 is done same machine but xp noy, why?
You may need to wake SATA drivers into your XP CD, without the brand and model of your PC, I can't help you much further.
Although is there any reason stick you with XP to go to 7? -
How to transfer e-books to the library in ereader. A managed, can not do it again.
Hi Barbara,
Please follow the steps from here: OverDrive | How to transfer eBooks to an eReader usi...
Thank you
Abhishek
-
How can I get the Adobe Reader software, but NOT the "DC" Cloud version?
For years, I appreciated the help of the original Adobe Reader that would allow me to view PDFs via Windows Viewer or my other software, just, as I used to be able to do. Now, it seems that Adobe requires this convoluted "DC" on users version. I don't want to. I don't need all these so-called features. I don't want to "be in the clouds! -I want just a basic version that allows to display a clean image, strong, with zoom tools, etc.
Where can I get what I need, please? Of course, I hope for a version that has the day in safety.
I will appreciate it if someone would provide a URL to the "appropriate" download location link, unless Adobe no longer provides what some users want or need.
Hi Larry cross,
You can download Adobe Reader XI from the link below:
http://get.Adobe.com/reader/Enterprise/
You must select the operating system you use, the language of Adobe Reader you want to and the version of Adobe Reader (Select 11.0.10).
-
Photoshop CS5 and CS6, I can't change a color in the color picker. I can get white, black and grey, nothing else!
Help!
Is your picture > grayscale mode? Try to RGB
-
UNION and UNION ALL giving multiple result sets even if INTERSECT does not lines.
Hello
I have a set of two queries. I used the UNION to join the result set. When I used UNION ALL, I get a different result set.
BT when I use INTERSECT, I m not getting all the lines.
SO, which I guess is, as operation INTERSECT isn't Govind all the lines, then the UNION and UNION ALL of the result sets must be simliar.
But I m getting different result sets.
Please guide me.
Thank you.
Hello
UNION returns separate lines; UNION ALL returns all rows that produce queries.
INTERSECT has nothing to do with it. You can have the lines in a single query. For example
Job SELECTION
FROM scott.emp
UNION - ALL THE
SELECT 'FUBAR '.
DOUBLE;
In this example, there is no overlap between the 2 queries (INTERSECT would have 0 rows).
UNION produces 6 lines, because the query at the top of the page produces 5 distinct lines (of 14 total ranks) and the background query 1.
UNION ALL product lines 15: 14 of the request from top and 1 of the request from the lower part.
I hope that answers your question.
If not, post a test script (if necessary) and complete, including some UNION, UNION ALL queries INTERSECT. Post of the CREATE TABLE and INSERT statements for all tables using those queries (with the exception of the commonly available rtables, such as those of the scott schema) and a specific question, such as "the UNION query all product...» I expect the UNION query to produce... because... but instead, it produces... Why is this? It seems contractict... manual which says that... ».
-
Combine queries to get the result set with max Y
Hello
I use forms 6i and db 10.2.0.1.0
With the query below
the result set isSelect ufam_usrgrp,ufam_filegrp,ufam_read,ufam_write,ufam_overwrite,ufam_delete from usr_file_access_master Where ufam_ecode = '0004108';
Another queryUFAM_USRGRP UFAM_FILEGRP UFA UFA UFA UFA --------------- --------------- --- --- --- --- MGMNT CV Y Y Y Y EMPLOYEE GENERAL Y N N N EMPLOYEE PERSONAL Y N N N
gives the resultSelect uul_usrgrp, ufl_file_grp,ufl_read,ufl_write,ufl_overwrite,ufl_delete from usr_usrgrp_lnk,USRGRP_FILEGRP_LINK Where usr_usrgrp_lnk.uul_usrgrp = USRGRP_FILEGRP_LINK.UFL_USR_GRP and usr_usrgrp_lnk.uul_ecode = '0004108'
I need to combine these two queries to get a separate result set with maximum YUUL_USRGRP UFL_FILE_GRP UFL UFL UFL UFL --------------- --------------- --- --- --- --- MGMNT GENERAL Y Y Y Y EMPLOYEE GENERAL Y Y N N MGMNT CV Y N N N
Like here "MGMNT CV" is repeated in both the result set, but the first has more, then it should come from the combined result set. reverse-case also the same (such as "EMPLOYEE GENERAL")
So I want to combine the queries so that I get the result as set below
Please help me to combine these queriesUserGroup FileGroup Rd Wrt Owrt Del --------------- --------------- --- --- --- --- MGMNT GENERAL Y Y Y Y EMPLOYEE GENERAL Y Y N N MGMNT CV Y Y Y Y EMPLOYEE PERSONAL Y N N N
Published by: Divya on August 14, 2011 21:24
Changed the result set and the last exitNOT TESTED!
select y.uul_usrgrp, y.ufl_file_grp, greatest(ufl_read,nvl(ufam_read,' ')) ufl_read, greatest(ufl_write,nvl(ufam_write,' ')) ufl_write, greatest(ufl_overwrite,nvl(ufam_overwrite,' ')) ufl_overwrite, greatest(ufl_delete,nvl(ufam_delete,' ')) ufl_delete from (select ufam_usrgrp,ufam_filegrp,ufam_read,ufam_write,ufam_overwrite,ufam_delete from usr_file_access_master Where ufam_ecode = '0004108' ) x, (select uul_usrgrp, ufl_file_grp,ufl_read,ufl_write,ufl_overwrite,ufl_delete from usr_usrgrp_lnk,USRGRP_FILEGRP_LINK Where usr_usrgrp_lnk.uul_usrgrp = USRGRP_FILEGRP_LINK.UFL_USR_GRP and usr_usrgrp_lnk.uul_ecode = '0004108' ) y where y.uul_usrgrp = x.ufam_usrgrp(+) and y.ufl_file_grp = x.ufam_filegrp(+)
Concerning
Etbin
Edited by: Etbin on 14.8.2011 13:08
deleted by group -
Generate a single XML file of the multiple JDBC result set
Hello
I need to create a single XML file of the multiple result set. The code below is to generate a XML signle leave a single result set, but suppose we have five different tables in the same database and the tables aren't relalted to the other.
for example: select * from SAMPLE_PRODUCT
Select * command
Select * LOGISTICS... and many others.
You can create multiple sets of results by top queries but how can write all values using a JDBC result set in a single xml file? Help, please.
a signle file xml from one generator result
import java.io.StringWriter;
import java.sql.Connection;
to import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
Import javax.xml.parsers.DocumentBuilder;
Import javax.xml.parsers.DocumentBuilderFactory;
Import javax.xml.transform.OutputKeys.
Import javax.xml.transform.Transformer;
Import javax.xml.transform.TransformerFactory;
Import javax.xml.transform.dom.DOMSource;
Import javax.xml.transform.stream.StreamResult;
to import org.W3C.DOM.document;
Import org.w3c.dom.Element;
public class JDBCToXML {}
Public Shared Sub main (string args []) throws Exception {}
DocumentBuilderFactory plant = DocumentBuilderFactory.newInstance ();
DocumentBuilder builder = factory.newDocumentBuilder ();
Doc document = builder.newDocument ();
Element results = doc.createElement ("Results");
doc.appendChild (results);
Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager
.getConnection("jdbc:odbc:RIS","USER","USER");
ResultSet rs = con.createStatement () .executeQuery ("select * from SAMPLE_PRODUCT");
ResultSetMetaData rsmd = rs.getMetaData ();
int colCount = rsmd.getColumnCount ();
While (RS. Next {}
Element line = doc.createElement ("Row");
results.appendChild (row);
for (int i = 1; i < = colCount; i ++) {}
String columnName = rsmd.getColumnName (i);
Object value = rs.getObject (i);
Element node = doc.createElement (columnName);
node.appendChild (doc.createTextNode (value.toString (()));
row.appendChild (node);
}
}
DOMSource domSource = new DOMSource (doc);
TransformerFactory tf = TransformerFactory.newInstance ();
Transformer transformer = tf.newTransformer ();
transformer.setOutputProperty (OutputKeys.OMIT_XML_DECLARATION, 'yes');
transformer.setOutputProperty (OutputKeys.METHOD, "xml");
transformer.setOutputProperty (OutputKeys.ENCODING, "ISO-8859-1");
StringWriter sw = new StringWriter();
StreamResult sr = new StreamResult (sw);
transform. Transform (domSource, sr);
System.out.println (SW. ToString());
con. Close;
RS. Close();
}
}
Thank you
Sumit
Published by: user8687839 on April 4, 2012 23:04
Published by: user8687839 on April 4, 2012 23:09As EJP says, you really want to get the data in a single request, if possible (and I don't see why that shouldn't be the case).
In fact, you really want to get this query to return the data as close the format you need as you can.If you did this on Oracle, for example, I'd get Oracle to produce XML that you can then turn (assuming that you could not itself produce the XML you want directly).
In your case, using some db (access?), and then just get the line structure such as the conversion to XML involves the least amount of faffing about.Rethink the SQL and the rest should be easy.
-
Ref cursor - result series is not known
Hi all
My requirement is as below
(1) the query to run is stored in a table because the query vary each time
(2) execution of the query and treat it
As the query could be of any table that I'm stuck on go get the query in a variable and treatment. Pls see my example below
CUR cursor is
Select sql_stmt sql1 - extract the sql to run
RTA;
Open p_cursor for sql1; -Open the ref cursor
loop
look for p_cursor in? * -as the result set does not know initially how to declare a variable for it *.
output p_cursor % notfound;
-the results of the process
end loop;
Help, please. Hope I'm clear with my question. If not, please let me knowOracle says:
Hi allMy requirement is as below
(1) the query to run is stored in a table because the query vary each time
(2) execution of the query and treat itAs the query could be of any table that I'm stuck on go get the query in a variable and treatment. Pls see my example below
CUR cursor is
Select sql_stmt sql1 - extract the sql to run
RTA;Open p_cursor for sql1; -Open the ref cursor
loop
look for p_cursor in? * -as the result set does not know initially how to declare a variable for it *.
output p_cursor % notfound;
-the results of the process
end loop;Help, please. Hope I'm clear with my question. If not, please let me know
Storage of queries in a table? This looks like a bad design, not to mention the possibility of SQL injection and causing ALL of your code to be written to be dynamic, where a nightmare to debug. Ouch!
You will not be able to do with a ref cursor if you don't know what to expect as the columns returned.
You can use the DBMS_SQL package and describe the query so that you can find on the columns and data types in the results... example of this package... (my example standard production CSV files)...-----
As user sys:
CREATE OR REPLACE DIRECTORY TEST_DIR AS '\tmp\myfiles' / GRANT READ, WRITE ON DIRECTORY TEST_DIR TO myuser /
As myuser:
CREATE OR REPLACE PROCEDURE run_query(p_sql IN VARCHAR2 ,p_dir IN VARCHAR2 ,p_header_file IN VARCHAR2 ,p_data_file IN VARCHAR2 := NULL) IS v_finaltxt VARCHAR2(4000); v_v_val VARCHAR2(4000); v_n_val NUMBER; v_d_val DATE; v_ret NUMBER; c NUMBER; d NUMBER; col_cnt INTEGER; f BOOLEAN; rec_tab DBMS_SQL.DESC_TAB; col_num NUMBER; v_fh UTL_FILE.FILE_TYPE; v_samefile BOOLEAN := (NVL(p_data_file,p_header_file) = p_header_file); BEGIN c := DBMS_SQL.OPEN_CURSOR; DBMS_SQL.PARSE(c, p_sql, DBMS_SQL.NATIVE); d := DBMS_SQL.EXECUTE(c); DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab); FOR j in 1..col_cnt LOOP CASE rec_tab(j).col_type WHEN 1 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000); WHEN 2 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_n_val); WHEN 12 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_d_val); ELSE DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000); END CASE; END LOOP; -- This part outputs the HEADER v_fh := UTL_FILE.FOPEN(upper(p_dir),p_header_file,'w',32767); FOR j in 1..col_cnt LOOP v_finaltxt := ltrim(v_finaltxt||','||lower(rec_tab(j).col_name),','); END LOOP; -- DBMS_OUTPUT.PUT_LINE(v_finaltxt); UTL_FILE.PUT_LINE(v_fh, v_finaltxt); IF NOT v_samefile THEN UTL_FILE.FCLOSE(v_fh); END IF; -- -- This part outputs the DATA IF NOT v_samefile THEN v_fh := UTL_FILE.FOPEN(upper(p_dir),p_data_file,'w',32767); END IF; LOOP v_ret := DBMS_SQL.FETCH_ROWS(c); EXIT WHEN v_ret = 0; v_finaltxt := NULL; FOR j in 1..col_cnt LOOP CASE rec_tab(j).col_type WHEN 1 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_v_val); v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',','); WHEN 2 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_n_val); v_finaltxt := ltrim(v_finaltxt||','||v_n_val,','); WHEN 12 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_d_val); v_finaltxt := ltrim(v_finaltxt||','||to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'),','); ELSE v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',','); END CASE; END LOOP; -- DBMS_OUTPUT.PUT_LINE(v_finaltxt); UTL_FILE.PUT_LINE(v_fh, v_finaltxt); END LOOP; UTL_FILE.FCLOSE(v_fh); DBMS_SQL.CLOSE_CURSOR(c); END;
This allows the header line and the data to write into files separate if necessary.
for example
SQL> exec run_query('select * from emp','TEST_DIR','output.txt'); PL/SQL procedure successfully completed.
Output.txt file contains:
empno,ename,job,mgr,hiredate,sal,comm,deptno 7369,"SMITH","CLERK",7902,17/12/1980 00:00:00,800,,20 7499,"ALLEN","SALESMAN",7698,20/02/1981 00:00:00,1600,300,30 7521,"WARD","SALESMAN",7698,22/02/1981 00:00:00,1250,500,30 7566,"JONES","MANAGER",7839,02/04/1981 00:00:00,2975,,20 7654,"MARTIN","SALESMAN",7698,28/09/1981 00:00:00,1250,1400,30 7698,"BLAKE","MANAGER",7839,01/05/1981 00:00:00,2850,,30 7782,"CLARK","MANAGER",7839,09/06/1981 00:00:00,2450,,10 7788,"SCOTT","ANALYST",7566,19/04/1987 00:00:00,3000,,20 7839,"KING","PRESIDENT",,17/11/1981 00:00:00,5000,,10 7844,"TURNER","SALESMAN",7698,08/09/1981 00:00:00,1500,0,30 7876,"ADAMS","CLERK",7788,23/05/1987 00:00:00,1100,,20 7900,"JAMES","CLERK",7698,03/12/1981 00:00:00,950,,30 7902,"FORD","ANALYST",7566,03/12/1981 00:00:00,3000,,20 7934,"MILLER","CLERK",7782,23/01/1982 00:00:00,1300,,10
The procedure allows for the header and the data to separate files if necessary. Just by specifying the file name "header" will put the header and the data in a single file.
Adapt to the exit of styles and different types of data are needed.
-
Firefox does not open. I get firefox is already running but not responding no window... I tried to restart without help. I tried to put an end to the process via Ctrl + Shift + Esc and nothing firefox is registered to complete. I tried to find the application via the icon data run in the start window, I have no icon running on this system (Acer with windows vista (?)
This has happened
Each time Firefox opened
The computer was hard to close and made an incorrect scan stop when it has restarted
User Agent
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; FunWebProducts; GTB6.5; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729)
Uninstall and re - install Firefox does not affect your personal data and settings in your Firefox profile folder, unless specifically, you select this option when Firefox un0installing - but which removes "all your personal data and customizations.
Have you tried to create a new profile after a cold start?
http://KB.mozillazine.org/Creating_a_new_Firefox_profile_on_Windows -
Query result set...
I can't determine a good word in my question. So, I think that my pseudocode below will be sufficient for this purpose.
Oracle version: 11.2 g
Data set
The result of the above query:WITH temp AS ( SELECT 1 col1, 1 day FROM dual UNION ALL SELECT 2 col1, 1 day FROM dual UNION ALL SELECT 3 col1, 1 day FROM dual UNION ALL SELECT 4 col1, 1 day FROM dual UNION ALL SELECT 5 col1, 1 day FROM dual UNION ALL SELECT 6 col1, 1 day FROM dual UNION ALL SELECT 7 col1, 2 day FROM dual UNION ALL SELECT 8 col1, 2 day FROM dual UNION ALL SELECT 9 col1, 2 day FROM dual UNION ALL SELECT 10 col1,2 day FROM dual ) SELECT * FROM temp
You the WISH result set:COL1 DAY 1 1 2 1 3 1 4 1 5 1 6 1 7 2 8 2 9 2 10 2
I realize that I can get the desired result, set above the code below. However, for my I have several other data points and 100 separate days I need to do for their actual issue. In doing so, a statement of the UNION 100 isn't exactly going to work.DAY COL_TOTAL 1 21 2 55 -- 21 + 33 (the sum of day 1 + the sum of day 2)
Published by: user652714 on August 13, 2012 21:55WITH temp AS ( SELECT 1 col1, 1 day FROM dual UNION ALL SELECT 2 col1, 1 day FROM dual UNION ALL SELECT 3 col1, 1 day FROM dual UNION ALL SELECT 4 col1, 1 day FROM dual UNION ALL SELECT 5 col1, 1 day FROM dual UNION ALL SELECT 6 col1, 1 day FROM dual UNION ALL SELECT 7 col1, 2 day FROM dual UNION ALL SELECT 8 col1, 2 day FROM dual UNION ALL SELECT 9 col1, 2 day FROM dual UNION ALL SELECT 10 col1,2 day FROM dual ) SELECT SUM(col1) AS col_total FROM temp WHERE day <= 1 UNION ALL SELECT SUM(col1) AS col_total FROM temp WHERE day <= 2
Hello
I now see what you want. You can use this:
select * from tt order by col_1; COL_1 DAY ---------- ---------- 1 1 2 1 3 1 4 1 5 1 6 1 7 2 8 2 9 2 10 2 10 rows selected. select day, sum(total) over (order by day) COL_TOTAL from (select day, sum(col_1) TOTAL from tt group by day ); DAY COL_TOTAL ---------- ---------- 1 21 2 55 2 rows selected.
-
I'm looking for only column compare to my same target table as a table source.
My query:
Select case when column_name_s is null and column_name_t is not null
then "alter table GRADE_CONVERSION drop | column_name_t | ';'
When column_name_s is not null and column_name_t is null
then "alter table GRADE_CONVERSION add | column_name_s | ' ' || data_type_s | « ; »
else 'alter table modify GRADE_CONVERSION | column_name_t | ' ' || data_type_t | « ; »
alterations of the end
from (select s.column_name column_name_s, t.column_name column_name_t,
s.data_type data_type_s, t.data_type data_type_t
(select column_name, column_id, data_type
of all_tab_cols@database
where owner = 'erhan.
and table_name = "GRADE_CONVERSION."
+ 1
full outer join
(select column_name, column_id, data_type
of all_tab_cols@database
where owner = 'sarigul.
and table_name = "GRADE_CONVERSION."
+ 6
on s.column_name = t.column_name
)
Tables:
Target table: table GRADE_CONVERSION in sarigul@database
LETTER_GRADE VARCHAR2 (2) GRADE_POINT NUMBER (3.2) MAX_GRADE NUMBER (3) MIN_GRADE NUMBER (3) Table source: Table GRADE_CONVERSION in erhan@database
LETTER_GRADE VARCHAR2 (2) GRADE_POINT NUMBER (3.2) MAX_GRADE NUMBER (3) MIN_GRADE NUMBER (3) CREATED_BY VARCHAR2 (30) CREATED_DATE DATE MODIFIED_BY VARCHAR2 (30) MODIFIED_DATE DATE want to see output that is similar to this * (please ignore the names of column here it's just a clear example :))
ALTER table Target_table change BOOK_ID Varchar2 (4);
ALTER table Target_table I addSBN_10 Varchar2(13), null;
ALTER table drop TITLE Target_table;
Erhan_toronto wrote:
1.I used src.nullable src_nullable and tgt.nullable tgt_nullable but only show Yes as below: but want to see the result as not null or null
ALTER table TEST_TARGET change the NUMBER of MAX_GRADE (3, 2) Yes
Ok. So it's all about the Yes and the no decoding to Default Null or Not Null, isn't it?
So, to test, change one of the table of sample for NOT NULL columns in the source table, and then run the following query:
with src as ( select src.table_name src_table_name, src.column_name src_col_name, src.data_type src_data_type, src.data_length src_data_len, src.data_precision src_data_precision, src.data_scale src_data_scale, src.nullable src_nullable from user_tab_columns src where table_name = 'TEST_SOURCE' ), tgt as ( select tgt.table_name tgt_table_name, tgt.column_name tgt_col_name, tgt.data_type tgt_data_type, tgt.data_length tgt_data_len, tgt.data_precision tgt_data_precision, tgt.data_scale tgt_data_scale, tgt.nullable tgt_nullable from user_tab_columns tgt where table_name = 'TEST_TARGET' ), col_details as ( select src.src_table_name, nvl(tgt.tgt_table_name, first_value(tgt_table_name) over(order by tgt_table_name nulls last)) tgt_table_name, src.src_col_name, src.src_data_type, src.src_data_len, src.src_data_precision, src.src_data_scale, src.src_nullable, tgt.tgt_col_name, tgt.tgt_data_type, tgt.tgt_data_len, tgt.tgt_data_precision, tgt.tgt_data_scale, tgt.tgt_nullable from src left outer join tgt on ( src.src_col_name = tgt.tgt_col_name ) ) select * from ( select case when tgt_data_type != src_data_type or tgt_data_len != src_data_len or tgt_data_precision != src_data_precision or tgt_data_scale != src_data_scale or src_nullable != tgt_nullable then 'alter table ' || tgt_table_name || ' modify ' || tgt_col_name || ' ' || src_data_type || ' (' || case when src_data_type in ('DATE') then null else case when src_data_type in ('VARCHAR', 'VARCHAR2') then nvl(to_char(src_data_len), ' ') || ') ' else decode(nvl(src_data_precision, -1), -1, null, nvl(to_char(src_data_precision), ' ') || ', ' || nvl(to_char(src_data_scale), ' ') || ')') end end || decode(src_nullable, 'NO', ' NOT NULL', ' DEFAULT NULL') when tgt_col_name is null then 'alter table ' || tgt_table_name || ' add ' || src_col_name || ' ' || src_data_type || case when src_data_type in ('DATE') then null else case when src_data_type in ('VARCHAR', 'VARCHAR2') then nvl(to_char(src_data_len), ' ') || ') ' else decode(nvl(src_data_precision, -1), -1, null, nvl(to_char(src_data_precision), ' ') || ', ' || nvl(to_char(src_data_scale), ' ') || ')') end end || decode(src_nullable, 'NO', ' NOT NULL', ' DEFAULT NULL') end alter_statement from col_details ) where alter_statement is not null;
Erhan_toronto wrote:
2. when I run below under user sarigul and erhan I get the result as OWNER, TABLE_NAME, COLUMN_NAME DATA_TYPE... I have a link between two users. They have access to two tables.
- Select * from all_tab_columns
where owner = 'erhan' and table_name = "TEST_SOURCE."
- Select * from all_tab_columns
where owner = 'sarigul' and table_name = "TEST_TARGET."
Alright. This means that you both users are on the same database. Only change, you will have to do in the above query is so change user_tab_columns to all_tab_columns and add the OWNER predicate respectively with the clause.
Maybe you are looking for
-
When I disable cookies cookies have been established.
I normally turn off cookies completely and then promotes 'Exceptions' for some areas. However, with the latest version of Firefox, even sites that are not in my list of Exceptions are able to set cookies. Why are cookies will still be allowed for are
-
my apple account looked, I can't reach my back I cloud for my new i phone, I tried to change the password to my hotmail account, but I forgot. also, I forgot the qwestion to change the password. Please help me
-
The locale-specific decimal separator in Fmt?
Is there a way to get the floating point numbers using the locale-specific decimal separator in the Fmt() function? It seems that SetSystemAttribute will only change the separator of UI elements, as described in this thread. Call setlocale (LC_ALL,
-
I can generate a list of addresses of a polygon shape in the streets & trips?
I've built a number of forms of polygon closed in Microsoft streets & trips 2011. Is there a way to generate a list of addresses contained in these forms? Thank you.
-
installation of expedia streets 98 in windows vista problem
I like expedia streets 98 but cannot be installed in my Dell with windows vista home basic edition. After installing and opening of the mapping program, my computer said I have problems with the Pushpins (there is no reference) and I restarted it fo