Home > database >  SQL share (AND the PRIOR DBMS_RANDOM. The VALUE IS NOT NULL) IS redundant
SQL share (AND the PRIOR DBMS_RANDOM. The VALUE IS NOT NULL) IS redundant

Time:09-25

SQL share (AND the PRIOR DBMS_RANDOM. The VALUE IS NOT NULL) IS redundant, excluding influential?

SELECT 'TEST2' TABLE_NAME,
REGEXP_SUBSTR (COL1, COL2, '[^,] +' 1, LEVEL) COLUMN_NAME FROM DUAL
CONNECT BY LEVEL


SELECT 'TEST2' TABLE_NAME,
REGEXP_SUBSTR (COL1, COL2, '[^,] +' 1, LEVEL) COLUMN_NAME FROM DUAL
CONNECT BY LEVEL CodePudding user response:

Good question, encouraging;

If only for a line of data, to be apart, so this condition can be removed;
Just try to two (or more rows of data) :

Select col1, col2 from dual
Union all
Select 'col3 col4,' the from dual

CodePudding user response:

To learn...

CodePudding user response:

Try not to know.

CodePudding user response:

Learning

CodePudding user response:

Learning,,,,,,,,,

CodePudding user response:

Learning, pass by,

CodePudding user response:

 
As with TEST2
(select 'COL1, COL2 as col_name
The from dual
Union all
Select 'col3 col4,'
The from dual)

SELECT 'TEST2' TABLE_NAME,
REGEXP_SUBSTR (TEST2 col_name, '[^,] +' 1, LEVEL) COLUMN_NAME
The FROM DUAL
CONNECT BY LEVEL & lt;=LENGTH (REGEXP_REPLACE (TEST2 col_name, '[^,] +')) + 1
AND the PRIOR sysdate IS NOT NULL;



An error Test2. Invalid col_name definition,,, where is wrong

CodePudding user response:

refer to the eighth floor q12344566789 response:
 
As with TEST2
(select 'COL1, COL2 as col_name
The from dual
Union all
Select 'col3 col4,'
The from dual)

SELECT 'TEST2' TABLE_NAME,
REGEXP_SUBSTR (TEST2 col_name, '[^,] +' 1, LEVEL) COLUMN_NAME
The FROM DUAL
CONNECT BY LEVEL & lt;=LENGTH (REGEXP_REPLACE (TEST2 col_name, '[^,] +')) + 1
AND the PRIOR sysdate IS NOT NULL;



Error Test2. Col_name invalid definition,,, it is a wrong place


@ the net of selling fruits help have a look

CodePudding user response:

references 9 f q12344566789 response:
Quote: refer to the eighth floor q12344566789 response:

 
As with TEST2
(select 'COL1, COL2 as col_name
The from dual
Union all
Select 'col3 col4,'
The from dual)

SELECT 'TEST2' TABLE_NAME,
REGEXP_SUBSTR (TEST2 col_name, '[^,] +' 1, LEVEL) COLUMN_NAME
The FROM DUAL
CONNECT BY LEVEL & lt;=LENGTH (REGEXP_REPLACE (TEST2 col_name, '[^,] +')) + 1
AND the PRIOR sysdate IS NOT NULL;



Error Test2. Col_name invalid definition,,, it is a wrong place


@ the net of selling fruits look


I bug again,,, from test2 is not ready,, silly off my

CodePudding user response:

references to the tenth floor q12344566789 response:
I bug again,,, from test2 is not ready,, silly off my


CodePudding user response:

11 references wmxcn2000 response:


A great god, and I still have a question,
The result is
 
As with TEST2
(select 'COL1, COL2 as col_name
The from dual
Union all
Select 'col3 col4,'
The from dual)

SELECT distinct 'TEST2' TABLE_NAME,
REGEXP_SUBSTR (col_name, '[^,] +' 1, LEVEL) COLUMN_NAME
The FROM TEST2
CONNECT BY LEVEL & lt;=LENGTH (REGEXP_REPLACE (col_name, '[^,] +')) + 1
and the PRIOR DBMS_RANDOM. The VALUE IS NOT NULL;


 
TABLE_NAME COLUMN_NAME
1 TEST2 COL2
2 TEST2 COL1
3 TEST2 col4
4 TEST2 col3



With a distinct, isn't it feel a little YingCou ah, in addition to remove the red place, the result is the same,,

CodePudding user response:

The
refer to 12 floor q12344566789 reply:
add a distinct, feels a bit YingCou ah, in addition to remove the red place, the result is the same,,


 
- add a PK list
As with TEST2
(select 'COL1, COL2 as col_name, 1 id
The from dual
Union all
Select ', col3 col4, 2
The from dual
)

SELECT 'TEST2' TABLE_NAME,
REGEXP_SUBSTR (col_name, '[^,] +' 1, LEVEL) COLUMN_NAME
The FROM TEST2
CONNECT BY the PRIOR id=id
And LEVEL & lt;=regexp_count (col_name, ', ') + 1
VALUE IS NOT NULL and the PRIOR DBMS_RANDOM.

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related