return null from select in oracle sql developer - oracle-sqldeveloper

I'm using oracle database 12c in windows x64.
I imported an oracle database(from a .dmp file). The detail information view from oracle sql developer shows:
NUM_ROWS:74524900; BLOCKS:1356877; AVG_ROW_LEN:126; SAMPLE_SIZE:2000
However, when I try to run sql commands:
select * from <table_name> where rownum<=10;
or select * from <table_name>;
I got nothing returned. And the status show the retrieved number of rows: 0 ("提取的所有行:0").
I also try to run these commands in cmd, and failed again. The returned information is "No row is selected" (未选定行).
Please help. Thx!

Thanks nop77svk. This is because I failed to import the table. A close look at the import log file show that the table failed to pass 8192 extension (oracle error 1653). A drawback of 42679603 lines occurred.
I guess I may need to import the table one by one. And turn on the autoextend option of the tablespaces.
Thanks anyway.

Related

dBeaver (CE): DB2 LUW Connection with SQL ERROR 42704. Table Schema won't open but able to write SQL queries

After about a year and half, I am finally able to connect to the DB2 database we have through dBeaver. The connection is successful as a LUW (Our db2 is z/os). I was able to get the drivers required after installing IBM Data Studio.
Once I am connected, I go down the schema, get to Tables, and on clicking that, I get the below error.
SQL Error [42704]: SYSCAT.SCHEMATA IS AN UNDEFINED NAME. SQLCODE=-204, SQLSTATE=42704, DRIVER=3.69.56
SYSCAT.SCHEMATA IS AN UNDEFINED NAME. SQLCODE=-204, SQLSTATE=42704, DRIVER=3.69.56
THE DESCRIBE STATEMENT DOES NOT SPECIFY A PREPARED STATEMENT. SQLCODE=-516, SQLSTATE=26501, DRIVER=3.69.56
THE CURSOR SQL_CURLH200C1 IS NOT IN A PREPARED STATE. SQLCODE=-514, SQLSTATE=26501, DRIVER=3.69.56
SQL Error [42704]: SYSCAT.SCHEMATA IS AN UNDEFINED NAME. SQLCODE=-204, SQLSTATE=42704, DRIVER=3.69.56
However, if ignore the error and go to New SQL query and write a simple
Select * from schema.table
it works fine and get the results I want.
Considering the time i have spent to get till here, this is sufficient, but to deploy as a solution in my department, I need to be able to look at a Table List (schema).
Any help would be awesome.
EDIT1: What the issue is here, is that there is no SCHEMA with the name SYSCAT and no table named SCHEMATA.
The z/OS Db2 catalog has different names than the ones used on Db2 on distributed (Linux Unix Windows aka LUW). Here is a list of objects on Db2 z/OS that you can review.
It looks like you are using dBeaver to navigate through a UI the objects on Db2 for z/OS. You will need to ensure you have a db2 jcc driver that is for z/OS Db2. It looks like you may be using one from LUW as the SYSCAT.SCHEMATA is an LUW object, not a z/OS object.
Your other query works because you are specifying a known table name. Other queries should be fine. The issue is the interface in dbeaver is looking at Db2 system objects for LUW and not z/OS. This will continue until you are able to resolve the driver issue.
The IBM Data Server Drivers also require server sided set-up. Please see this information https://www.ibm.com/support/knowledgecenter/SSEPEK_12.0.0/java/src/tpc/imjcc_jccenablespsandtables.html
In DBeaver, when you create a connection choose the "DB2 z/OS driver" option under the Db2 drop down, when connecting to DB2 for z/OS
BTW DBeaver can shell share with Data Studio, so you can (if you wish) use both products in one install. No guarantees that they share happily in all cases, but it appears to work reasonably well.

Postgresql relation does not exist

I am connecting to my PostgreSQL DB on AWS RDS through SQL workbench. i have created a new table. it created successfully. table name is like public.xyz.
Now when i am trying to access the select query on 'public.xyz' i am getting error like
'Relation public.xyz does not exist'.
i have checked that my show_path contains %user,public. no case issue.
i have tried select query like select * from public.xyz and select * from xyz etc.. all have same issue
please suggest.
it seems to be a problem with SQL workbench. when i tried to create table using psql client on a linux machine, it worked properly. now i am able to run the same select query which was failing earlier. don't know inner details, but it seems to be an issue with SQL workbench.

SAS Connection to DB2 Via ODBC Error

I have been working in SAS connecting to DB2 via ODBC for a while now and this PROC SQL step generally works:
proc sql;
connect to odbc(dsn=DSQ user="UserID" password="Password");
execute (set current degree = 'ANY' ) by ODBC;
create table tempTable as select * from connection to odbc (
select *
from schemaName.tableName
);
quit;
However, occassionally I get the following error, and when I get this error I won't be able to run another ODBC query for quite some time because everytime I try to run the query I get the same error:
ERROR: CLI error trying to establish connection: [IBM][CLI Driver] SQL1042C An unexpected system
error occurred. SQLSTATE=58004
After some time the error either resolves itself or I do something that I am not aware of that fixes the issue. This is a very frustrating issue and since I never know how long this issue is going to persist I would like a more robust solution to this issue. I have checked the db2diag.log file and here is the part that describes this error:
2015-06-03-08.17.34.345000-300 I60888H446 LEVEL: Error
PID : 4452 TID : 7804 PROC : sas.exe
INSTANCE: DB2 NODE : 000
HOSTNAME:
EDUID : 7804
FUNCTION: DB2 Common, Cryptography, cryptDynamicLoadGSKitCrypto, probe:998
MESSAGE : ECF=0x90000007=-1879048185=ECF_UNKNOWN
Unknown
DATA #1 : unsigned integer, 4 bytes
60
DATA #2 : String, 11 bytes
gsk8sys.dll
I was trying to find an example to put in this post so I ran this snippet of code in SAS to see if the error would come back, however it seemed to have resolved the error because after running this piece of code, I ran the initial code and it worked. Here is the code that seemed to have resolved the issue.
proc sql;
connect to odbc(dsn=DSQ user="UserID" password="Password");
execute (set current degree = 'ANY' ) by ODBC;
create table column_names as select * from connection to odbc (
select * from sysibm.syscolumns
);
quit;
I have tried googling this issue, but there isn't much help on this particular error. Is there any reason that the second SAS code would have fixed the issue I was having? Is there any way to fix this problem so it won't come back in the future?
Please note, when the error occurs, I am still able to run queries via ODBC in Microsoft Access without any problems. It appears this is an issue with just a particular instance.
System Setup:
Windows 7 64-bit
SAS 9.3 (32)
DB2 v10.5.300.125
Thanks in advance for your help!
Update:
On a few occasions, I was able to go into task manager and delete some processes that were still running and then this issue would resolve itself, however today when this problem occurred, those processes weren't there. Any thoughts on this would be greatly appreciated.
The symptom may be depended on the installation order of Db2 connect and a program (sas.exe). If DB2 connect is installed first, it should not be occurred. So it is suggested to remove and re-install both products once then install Db2 connect first.
Hope this helps.

How do you import a spreadsheet into DB2?

I have a CSV file, but this could apply to any txt, data, or xls file. (xlsx) I have exported the data from one source and I want to import the data into a DB2 table.
I first tried Data Tools Plugin (DTP) in eclipse Helios (3.6.3) by right clicking on the table and selecting: Data > Load...
But I got this error:
Loading "myschema"."mytable"... com.ibm.db2.jcc.am.SqlException:
[jcc][10103][10941][4.14.113] Method executeQuery cannot be used for
update. ERRORCODE=-4476, SQLSTATE=null Data loading failed.
Then I tried Eclipse SQL Explorer on Eclipse Juno, but it does not support data import.
How do I get past this error so I can import?
You can import a CSV file directly into DB2 via the IMPORT or LOAD command, even with XML or BLOB as part of the data to import.
The procedure to import depends on the structure of the file you are going to import. Probably you should modify the default behaviour of these commands; DB2 has many option to adapt the command to the input file.
For more information about:
The import command: http://publib.boulder.ibm.com/infocenter/db2luw/v10r1/topic/com.ibm.db2.luw.admin.cmd.doc/doc/r0008304.html
The Load command http://publib.boulder.ibm.com/infocenter/db2luw/v10r1/topic/com.ibm.db2.luw.admin.cmd.doc/doc/r0008305.html
I think your question was more oriented to: how to use Eclipse to import data in DB2 from a CSV file. However, as I said, you can do that directly via DB2.
If you are going to import a file like the next one, the only thing that you need is to have access to a db2 client.
data.txt
1,"Andres","2013-05-18"
2,"Tom","2011-04-16"
3,"Jessica","2002-03-09"
You import with
db2 import from data.txt of del insert into test
I solved this by installing Eclipse Juno (4.2) and Data Tools Plugin (DTP) 1.10.2.
Now Data > Load... will work fine. This is the new message I get:
Data loading was successful. 142 row(s) loaded. 135 row(s) could not
be loaded.
com.ibm.db2.jcc.am.go: DB2 SQL Error: SQLCODE=-407, SQLSTATE=23502,
SQLERRMC= , DRIVER=4.7.85 One or more values could not be set in the
following column(s): USER_TIME, USER_DATE
FYI for the entire process I was using this:
DB2 driver: /opt/IBM/db2/V9.7/java
With jar files: db2jcc4.jar, db2jcc_license_cisuz.jar
Driver Class: com.ibm.db2.jcc.DB2Driver
You can import using DB2 "Control Center" *
Right Click the table and select "Import"
Then specify the csv file and message file
message file is important because in the case of failed upload, you can find the error cause in the message file
* Control Center is now deprecated in favor of "Data Studio"
From the db2 console, try this:
Import from 'yourcommaseparatedfile.csv' of del insert into "SCHEMA"."TABLE"
Regards =)
db2 'import from /users/n0sdsds/test.csv of del insert into ENTPRISE.tmp_x'

Exporting db table from SQL Server 2008 R2 to Excel 2007

SQL Server 2008 R2 (management tool, not coding as I'm a bit of a noob) to Excel.
I need to export info from my db table COMPANY (some feilds varchar(50) some nchar(10)) to an Excel spreadsheet which i just created as normal - Excel > New > Blank.
Everything seems to be straight forward but just cant see the problem... Please see below and thanks a million in advance :)
Pre-execute (Error) Messages Error 0xc0202009: Data Flow Task 1: SSIS
Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code:
0x80040E21. (SQL Server Import and Export Wizard)
Error 0xc0202025: Data Flow Task 1: Cannot create an OLE DB accessor.
Verify that the column metadata is valid. (SQL Server Import and
Export Wizard)
Error 0xc004701a: Data Flow Task 1: component "Destination - COMPANY"
(37) failed the pre-execute phase and returned error code 0xC0202025.
(SQL Server Import and Export Wizard)
Executing (Warning) Messages Warning: Preparation SQL Task 1: Multiple-step OLE DB
operation generated errors. Check each OLE DB
status value, if available. No work was done. (SQL Server Import and
Export Wizard)
Warning: Preparation SQL Task 1: Multiple-step OLE DB operation
generated errors. Check each OLE DB status value, if available. No
work was done. (SQL Server Import and Export Wizard)
Copying to COMPANY (Stopped)
Post-execute (Stopped) Messages Information 0x4004300b: Data Flow Task 1: "component "Destination - COMPANY" (37)" wrote 0 rows. (SQL
Server Import and Export Wizard)
When you're in the import wizard, at the point you've selected the table or view to export, click the [Edit Mappings] button. What solved my problem was to change the fields with an export data type of "Long Text" to "VarChar" 255 characters.
Your source table might contain some column with NVARCHAR data type that’s why you are getting this error.
It’s not good solution still i will give try to change data type of column from NVARCHAR TO VARCHAR.
Thanks
Dhiraj