Using the display Format of the SQL queries as below.
Hello...I use Oracle Database 10 g Release 2 (10.2.0.4.0).
Sample data is,
create table table1 (col1, col2 number);
Insert into table1 values (1,2);
Insert into table1 values(null,10);
Insert into table1 values (3,4);
Insert into table1 values(89,null);
Insert into table1 values (5,6).
create table table2 (col1, col2 number);
Insert into table2 values (3,2);
Insert into table2 values(9,null);
Insert into table2 values (5,4).
Insert into table2 values (7.6);
Insert into table2 values(null,87);
By using two tables, I need output like below.
col1 col2
------ --------
1 2
2 3
3 4
4 5
4 W
I remember his interview Question. I know its meaning less. But I need output only.
Thank you!!
Smiles..,.
Vijayrajaram
with t as(
select t1.col1 a, t1.col2 b, t2.col1 c, t2.col2 d
from table1 t1
left join table2 t2
on t1.col2 = t2.col2
where t1.col1 is not null and t1.col2 is not null
)
select a,b from t
union
select d,c from t
where d != 6
output:
A AND B
1 2
2 3
3 4
4 5
4 W
Tags: Database
Similar Questions
-
Hello.
I use gR 10, 3 of the UMC.
Is it possible to see all the sql queries that are used by the Complutense University of Madrid.
In my case, I've defined a query in Sitestudio, which looks like this
I want to know the SQL of the query.dDocType <matches> 'someType'
Thanks for all the answers
BrahimHello
Navigate to Administration - System Information Audit - tracing of the Sections - active Sections.
Put systemdatabase, searchquery and enable detailed full tracing.
This will give you the sql queries running for all actions on the Complutense University of MADRID.
Systemdatabase gives all of the query sent to DB by UCM.
SearchQuery gives the query when the clause are formed during a search.
Thank you
Srinath -
How to select only the part by using the sql query
Hello
I have the task to retrieve only the integral of the input text by using the sql query.
The entry is as follows
Entry for the price setting
$12.5 (FYI without space)
$ 12.5 (FYI single space)
$ 12.5 (double space FYI)
$12.5 (FYI multiple space)
$12.5 (FYI multiple space)
Output expected of 12.5
The price is the type varchar2 column in the store_price table.
Please let me know how to achieve this.
Thanks in advance.
If this is always the case that you get a $ followed by a number of places, you can use something like:
Select to_number (ltrim ('$ 12.5',' $')) DOUBLE
or
SELECT ltrim ('$ 12.5',' $') OF double
but take care of your nls_numeric_character settings if they are defined so that, for example, a comma is the decimal separator, you will have a problem.
HTH
-
A question, when you use the sql Profiler features!
Hi all.
I have a question, when using feautre profile sql to oracle 10 g 2.
As you know, 'DBMS_SQLTUNE. Procedure EXECUTE_TUNING_TASK' gives us
a sql plan imploved automatically.
However, in the event that the sql recommended plan of 'DBMS_SQLTUNE. EXECUTE_TUNING_TASK ".
is not good enough to accept the plan sql generated, and instead, I have a better plan of sql.
What should I do?
Is it possible to force oracle to use my plan sql instead of plan recommended by oracle sql?
The stored outline is not an option.
Thanks in advance.
Best regards.It seems that you really want to use the sql Profiler then?
You can grant not only the instruction for this plan you want?
If you want to manually create a profile, and then see the post below Kerry Osborne, essentially, you can remove the indicators needed to education to listen to v$ sql_plan and then their card in a profile for the original statement:
http://kerryosborne.Oracle-guy.com/2010/07/SQLT-coe_xfr_sql_profilesql/See also the paper of Christian Antognini on profiles:
http://Antognini.ch/papers/SQLProfiles_20060622.PDF11 g, base lines offer a much better facility to trace a plan from a single statement in a reference to another database.
-
creation of database using the SQL command * more
Hello
This isn't a matter of urgency.
I learn the Oracle DBA. I have installed Oracle 9.2 in my windows system. And I'm trying to create a database using the SQL command.
OracleVersion: 9.2
Windows XP operating system
I get the error like below when executing the CREATE DATABASE command.CREATE DATABASE suri USER SYS identified by manager USER system identified by surendra LOGFILE GROUP 1 ('F:\Oracle\oradata\suri\redo01.log') SIZE 100M, GROUP 2 ('F:\Oracle\oradata\suri\redo02.log') SIZE 100M, GROUP 3 ('F:\Oracle\oradata\suri\redo03.log') SIZE 100M MAXLOGFILES 5 MAXLOGMEMBERS 5 MAXLOGHISTORY 1 MAXDATAFILES 100 MAXINSTANCES 1 CHARACTER SET US7ASCII NATIONAL CHARACTER SET AL16UTF16 DATAFILE 'F:\Oracle\oradata\suri\system01.dbf' size 200M EXTENT MANAGEMENT LOCAL UNDO tablespace undots datafile 'F:\Oracle\oradata\suri\undots01.dbf' size 200M DEFAULT TEMPORARY TABLESPACE tempts1 DATAFILE 'F:\Oracle\oradata\suri\temp01.dbf' SIZE 100M EXTENT MANAGEMENT LOCAL
I have validated the syntax but not able to find where is the error.ERROR at line 16: ORA-25139: invalid option for CREATE TEMPORARY TABLESPACE
Please let me know if you need more details.
Thanks in advance for your help.
Kind regards
SuriOracleVersion: 9.2
Why a so old version (and desupported)? In any case...
TEMPORARY TABLESPACE tempts1 DATAFILE 'F:\Oracle\oradata\suri\temp01.dbf' SIZE 100 M EXTENT MANAGEMENT LOCAL default
.. try change DATAFILE with TEMPFILE.
-
A loop using the SQL select query.
Hello
I wanted to know, if the concept of loop is possible thanks to the SQL select statement.
For example
=======
Table T1
Col1 Col2
Slim 10
I want to write a query in such a way, so that when I get the result of the query, I format below.
Col1 Col2
Slim 10
Slim 10
Slim 10
Basically what I'm trying to achieve is, I have a table with two columns and it has a single line displayed above.
I want to display this line several times as the output of my SELECT query.
Let me know, if this target is achievable.
Kind regards
SaurabhLike this?
SQL> SELECT 10 col1, 'Sourabh' col2 2 FROM DUAL 3 CONNECT BY LEVEL <= 3; COL1 COL2 ---------- ------- 10 Sourabh 10 Sourabh 10 Sourabh SQL>
-
Using the SQL with CFQUERY statement variable
I generate a SQL statement based on user input. I use loops, etc. to create the string of the current statement.
Once the SQL string is created I can display it on the screen and it seems fine.
If I copy the text that appears on the screen and paste it into a CFQUERY, it works very well.
BUT if I try to the variable output directly in the CFQUERY tags set string - it fails... what gives?
Here is the text of the string I am generating in a variable called #insertString #.
INSERT INTO atblProduct (PRODUCTTITLE, RELATEDPRODUCTS, PARTCODENAME, DISPLAY, PRODFAMILYID, DETAILEDDESCRIPTION, overview, APPLICATION type, SPECIALTAB) VALUES (' product ', '1,2,3', ' Code Name', 1, 1, 'Detailed Description', 'Preview', 1, 1)
in the code below, you will see how I try to run this sql using the variable in a CFQUERY tag. Do I need to use a CF function to ensure it is passed verbatim to the SQL engine?
< CFQUERY datasource = "mydb" >
#insertString #.
< / CFQUERY >Try the function PreserveSingleQuotes.
-
Need help, unable to connect to the ODBC database using the SQL Toolbox!
Hi all
I'm playing around with the evaluation of SQL Toolkit (2.2 + patch) and I'm having trouble.
I ran the example 'connect' program and it seems to work fine.
However, I try to write my own program, and I get the same message:
"Service connection BD: (return value ==-10 [0xFFFFFFF6])."
Native error - 2147467259 code 0x80004005
The message is different from time to time, but the return value is constant.
I use Microsoft SQL Server 2012 and MySQL.
For MySQL, I installed the last Connector ODBC, 5.3.4. Inside the Control Panel / Data Sources (ODBC), I have a DSN called test_mysql in DSN user and system DSN.
I ran a test on the connection and the test passes. I don't know if I have to use the ansi or unicode driver, I tried both with the same success.
I do not know I had properly configured the SQL Server connection and who will try again.
My Code CVI is quite simple:
hdbc = connection BD ("DSN = test_mysql");
Whenever I get a - 10 BD. Either I have something configured wrong or am I missing something.
Does anyone have any suggestions?
Update 2:
After getting off the phone with Technical Support, the problem has been identified!
LabWindows SQL Toolkit requires 32 bits DNS. My PC is a 64-bit, so my default DNS Manager in 64-bit.
I needed to use the DNS Manager 32-bit when you work with the box tool.
Once I created my DNS connections using the 32-bit version of the Datga ODBC Source manager, everything worked fine.
See this technical note:
http://digital.NI.com/public.nsf/allkb/E7984C0DA0F0E65086257694005B4CB7
-
How to find the sql queries executed in one day with the sql and runtime text
Hi Experts,
Please tell me the sql query to find out the queries executed on a particular day and the runtime and the sql text of the query.
Please reply urgent.
Thanks in advance
Database instance 'A' may have run 100 SQL queries today. As for the instance of database 'B' could have exploited queries SQL 1 million today. Instance of database 'B' to 'keep' the 1 million SQL statements - in memory or on disk do you expect? Of course not. There the age or flush or invalidate memory SQL statements. He can't keep them on the disk (imagine running a completely different set of 1.2million SQL statements tomorrow and 1.3 the next day).
AWR and StatsPack can make counts the number of "n" top of the page ("n" default to 30) SQL statements which are still present in the cache of the library (not years, rinsed, invalidated) when a snapshot was taken. They can't declare "all" SQL statements.
To return to your needs. WHY do you need all the SQL statements? Or are there only certain operations specific SQL would you be interested? Could they have been treated by allowing audit (for example, UPDATE and DELETE with EXTENDED verification instructions)?
Hemant K Collette
-
generations of months using the sql query
Hello
Based on the input of date parameter, I need display every month in the current year and last year.
For example, suppose that my setting date is December 5, 14 ', I need the output below.
JANUARY
FEBRUARY
MARCH
APRIL
MAY
JUNE
JULY
AUGUST
SEPTEMBER
OCTOBER
NOVEMBER
DECEMBER
JANUARY
FEBRUARY
MARCH
APRIL
PEUT
Until the month of May and the month last year. I came with the request. Please find the following query.
Select to_char (add_months (trunc(sysdate,'year'), level-1), 'MONTH') mth
of the double
connect by level < = 12
Union of all the
Select to_char (to_date (ddate, 'MM'), 'MONTH') month
(select 1 + rownum - 1 ddate
from user_objects
where (1 + rownum - 1) < = to_number (to_char (to_date ('12-05-14', ' dd-mm-yy'), 'mm')));
But I don't want to use the data user_objects dictionary. Can you please guide how to achieve this output, or can u give me some other request too if possible.
Thank you
Siva
Try the below
SELECT TO_CHAR (ADD_MONTHS (ADD_MONTHS (TRUNC (TO_DATE(:date1,'DD-MM-YY'), 'MM'),
((- MONTHS_BETWEEN (trunc (to_date(:date1,'DD-mm-YY'), 'MM'), trunc (to_date(:date1,'DD-mm-YY'), 'YY')) + 12)).
(LEVEL-1))
, 'MONTHS '.
'NLS_DATE_LANGUAGE = ENGLISH') FROM dual months_between
CONNECT BY LEVEL<=>=>
-
utils is a packege so should I use the SQL instead of utils.
Hello
everything in translating my MS in mssql to oracle is converted into code bit: utils
utils is a set I think so is it good to use it or do I find any equivenlent sql function.
so please tel me oracle sql function for utils.patindex ();
Yours sincerelyAn Oracle database is not delivered with a package called "utils". We have no idea what is this package. We do not know what it contains.
If someone in your organization or a tool that you use to convert the SQL Server T - SQL code to Oracle PL/SQL code created a package which simulates some T - SQL functions, you must determine if it is useful to use this package or using the built-ins Oracle. It may be wise to normalize the using the utils package if the hope is that the vast majority of the code will be converted by a tool and not touched by man so that there is consistency between the code base. It may be wise to normalize the Oracle built-in functions if the goal is to make easily understandable code for Oracle developers who do not know the T - SQL functions that are simulated. This isn't something that we can answer for you.
Justin
-
Dimension to build using the SQL table and process to populate the SQL table
I have a dimension in a cube that is manually* built by one of our power users. Now, I have to get all the information of members of this dimension in a SQL table (example: with columns... Level0, level0property, level1, level1property etc...) to use this table in the STUDIO for the responsibility of the Member.
Is there any easy process to do this? Currently I am building each line manually in the SQL table and there are 1100 + members in that manually built dimension. Please advice.Look at the outline of applied olap Extractor is a free utility
-
Hello. all.
I wonder how to find sql_id using a sql statement, including transport retrun and tab space multiple.
To be more precise,
My sql is:
Select
col_a,
col_b,
..
..
I usually use the following query to find the sql_id
Select sql_id in v$ sql where sql_text like 'MY SQL STATEMENT %.
When MY SQL STATEMENT includes carriage return and tab space multiple, how can I do?
Thanks in advance.
Best regards.Hello
Did you look at regular expressions? Use regexp_like instead of as.
http://www.Stanford.edu/dept/ITSS/docs/Oracle/10G/server.101/b10759/conditions018.htm
Kind regards
-
Using the SQL workshop APEX_INSTANCE_ADMIN
I'm on 5 APEX. I need to leave my user access to system change electronic/SMTP mail settings in my workspace without giving them access to the admin area pages work. I see there are the built APEX_INSTANCE_ADMIN.set_parameter, but I needed to let them run it from the SQL builder APEX (not in SQLplus under sys) workshop. I gave APEX_ADMIN_ROLE to my analysis schema. Is this possible? I tried and could not make it work.
Start
run immediately "ALTER SESSION SET CURRENT_SCHEMA = APEX_050000';"
APEX_INSTANCE_ADMIN. SET_PARAMETER('SMTP_HOST_ADDRESS','localhost');
end;
ORA-06550: line 3, column 1: PLS-00201: identifier 'APEX_INSTANCE_ADMIN' must be declared ORA-06550: line 3, column 1: PL/SQL: statement ignored
Thank you
I tested it on my case, that's what I did:
(1) as SYS:
grant APEX_ADMINISTRATOR_ROLE to demo;
2) log in as demo schema and run an APEX_INSTANCE_ADMIN:
BEGIN APEX_INSTANCE_ADMIN.ADD_WORKSPACE ( p_workspace_id => 12121212, p_workspace => 'DEMO_WORKSPACE', p_primary_schema => 'DEMO', p_additional_schemas => 'DEMO' ); END;
A successful!
When I revoke the grant with: revoke APEX_ADMINISTRATOR_ROLE of demonstration;
The statement was not successful:
BEGIN APEX_INSTANCE_ADMIN.ADD_WORKSPACE ( p_workspace_id => 12121212, p_workspace => 'DEMO_WORKSPACE', p_primary_schema => 'DEMO', p_additional_schemas => 'DEMO' ); END; ORA-06550: line 2, column 5: PLS-00201: identifier 'APEX_INSTANCE_ADMIN' must be declared ORA-06550: line 2, column 5: PL/SQL: Statement ignored
Did you completely remove your line of code "immediate execution"?
Concerning
Daniel
-
Can I use the SQL function while setting of passage in the links?
4.2.1
Hello
I have a report that is a hypertext link (using the column binding feature standard apex) to another page. One of the parameters (columns) I spend is a varchar column with & values. Now, there is a restriction on the passage, & in the apex in 4.2.1. I was wondering if we can use something as a replacement (COLUMN1 # #, ' & ','-')) in the connection settings?
Unfortunately, the column does not have an equivalent id that can be used.
All of the suggestions.
Thank you
Ryanryansun wrote:
4.2.1Hello
I have a report that is a hypertext link (using the column binding feature standard apex) to another page. One of the parameters (columns) I spend is a varchar column with & values. Now, there is a restriction on passage and in the apex in 4.2.1. I was wondering if we can use something like a replace(#COLUMN1#,'&','-')) in the connection settings?
Unfortunately, the column does not have an equivalent id that can be used.
All of the suggestions.
Thank you
RyanYou can create another field in your query that might contain the value "prepared" - you set this to be a hidden column in the report definition and use it in the URL.
Maybe you are looking for
-
There is nothing you can do to change the appearance and function of the control center on your iPhone... By default, you can not change the system scale, which is not cool. There are way more rocking that I don't use and I would like to change this
-
Impossible to watch videos using silverlight screen freezes
Original title: why Microsoft Silverlight always freezes up my laptop if I try to watch a video? And what can I do about it? I guess Microsoft Silverlight must have something to do with the video, because whenever I try to watch a video on my laptop
-
Hello I think buying a WRT1900ACS router, I am told by my dealer that it's the best choice to support a large number of devices of connection with streaming audio and video of my SIN, while maintaining a range of broad signal for a big house. I have
-
BlackBerry Smartphones trying to contact the support of maximum spindle, error message changes
When you try to contact support using the online form, so I can get my account reset, I get this error:
-
Salve a tutti,Sono alle prese con a problema sul mio ESXI (DL380p G8v2) che far host it networking di una VM Windows, the machine in the local the ESXI host e rete appunto vede questioned my host non vede VM, don't I enforce customer a rate o pingarl