oracle11g

Condition based spool generation in Oracle SQL script

孤者浪人 提交于 2019-12-25 02:46:11
问题 I have a scenario where we generate spool based on condition. The spool should generate only if user types y. column col noprint new_value elcm_script select decode(lower('&gen'),'y','C:\ELCM.SQL','n', 'null') col from dual; SPOOL c:\ELCM_DETAILS.SPL @&elcm_script spool off In the above it will generate spool file even if user type n like error reading file.. How to stop generating the spool if n.or how to remove spool which is generated/ 回答1: If you can put this controlling section into its

Grouping and counting

不羁岁月 提交于 2019-12-25 02:43:07
问题 I have a data set like this -- **Team Date W/L** Team_1 04/01/0012 W Team_1 06/01/0012 W Team_1 07/01/0012 L Team_1 14/01/0012 W Team_1 19/01/0012 W Team_1 30/01/0012 L Team_1 14/02/0012 W Team_1 17/02/0012 L Team_1 20/02/0012 W Team_2 01/01/0012 W Team_2 05/01/0012 W Team_2 09/01/0012 W Team_2 13/01/0012 L Team_2 18/01/0012 W Team_2 25/01/0012 L Team_2 05/02/0012 L Team_2 13/02/0012 L Team_2 19/02/0012 L Team_3 02/01/0012 W Team_3 02/01/0012 W Team_3 06/01/0012 W Team_3 10/01/0012 W Team_3

i cannot find a hint on 'Oracle SQL Developer' and 'Oracle Database 12c' inside Linux shell

送分小仙女□ 提交于 2019-12-25 02:38:10
问题 I want to run 'Oracle Database 12c' for training purposes, but as i've installed 'Oracle OTN Developer Day'(Linux 6 works) i cannot find a hint on 'Oracle SQL Developer' and 'Oracle Database 12c' inside this Linux shell? In docs on 'Oracle OTN Developer Day' i find its contents: Oracle Linux 6.5 Oracle Database 12c Release 1 Enterprise Edition Oracle XML DB Oracle SQL Developer Oracle SQL Developer Data Modeler Oracle Application Express Hands-On-Labs (accessed via the Toolbar Menu in Firefox

generate XML from oracle tables

…衆ロ難τιáo~ 提交于 2019-12-25 02:06:53
问题 Need to create one generic stored procedure which will take table name as input parameter and create xml file with below format. Xml file name should be table name. <XML> <TABLENAME></TABLENAME> <RECORDS> <RECORD> <COLNAME>AAA</COLNAME> <COLNAME>AAA</COLNAME> <RECORD> <RECORD> <COLNAME>AAA</COLNAME> <COLNAME>AAA</COLNAME> <RECORD> <RECORD> <COLNAME>AAA</COLNAME> <COLNAME>AAA</COLNAME> <RECORD> <RECORD> <COLNAME>AAA</COLNAME> <COLNAME>AAA</COLNAME> <RECORD> <RECORD> <COLNAME>AAA</COLNAME>

Reversing order of results in START WITH LPAD SQL query

依然范特西╮ 提交于 2019-12-25 01:53:06
问题 SELECT LPAD('*', 2*level-1)||SYS_CONNECT_BY_PATH(unit_data, '/') "battle_unit_id" FROM battle_units where connect_by_isleaf = 1 START WITH battle_unit_id= 600 CONNECT BY PRIOR parent_id = battle_unit_id; returns */F-16/Jet powered aircraft/Air/Doctrine where, F-16 is the great-grandchild of Doctrine. Question 1 I would like to reverse this order such that i get the following: */Doctrine/Air/Jet powered aircraft/F-16 Question 2 Currently, the battle_units table have battle_unit_id from 1 to 50

Reset cursor position after ResultSet updateRow

纵然是瞬间 提交于 2019-12-25 01:52:31
问题 For some reason, the Oracle JDBC driver may move the ResultSet cursor somewhere else (not to the same row, and not to the next row) when updateRow is called (I am also inserting and deleting rows). How can I avoid this problem? Note: The results are ordered by the primary key of the table (I've specified this in the SQL). But I'm increasingly suspecting that the "order by" clause is not working properly. 回答1: No where in the documentation says that after an updateRow operation the cursor is

About Mapping Object To Database Using Hibernate

冷暖自知 提交于 2019-12-25 01:49:44
问题 Hello guys i am new to hibernate. while i was surfing stack overflow for hibernate related topics i found this Need clarification about mapping objects to database, annotations, and one to many relationships after reading the solution i was a bit confused and started building the exact scenario to understand the actual mechanism behind many to one, where i used oracle 11g database. When i am running my project hibernate is generating the tables and FK relations automatically but in the time

how to increment the datetime value with the increment value as 30 minutes in oracle?

和自甴很熟 提交于 2019-12-25 01:43:27
问题 how to increment the datetime value with the increment value as 30 minutes in oracle? In mssql i used the following query for solve my problem, i need the equivalent query in oracle with mycte as( select cast('2012-01-01 00:00:00' as datetime) DateValue union all select dateadd(minute,30,DateValue) from mycte where dateadd(minute,30,DateValue) <= '2012-01-01 23:59:00') select DateValue from mycte option (maxrecursion 32767); result for the above query is as follows: DateValue 2012-01-01 00:00

How to convert rows to columns in Oracle SQL

好久不见. 提交于 2019-12-25 01:09:15
问题 For a requirement I have to create a query to show Employees Schedule per week. Query is like this: select weekday, sched_hrs from table where emplid = '12345' and weekday_name= 1 Output of this query is like: Weekday | Sched_hrs -------------------- 1 | 7.6 1 | 7.6 1 | 7.6 1 | 7.6 1 | 7.6 1 | OFF 1 | OFF I want the output in below format: 1 7.6 7.6 7.6 7.6 7.6 OFF OFF How to achieve it? 回答1: If you are OK with concatenated list , then use LISTAGG which was introduced in Oracle 11g Release 2

Combining data in multiple rows

天涯浪子 提交于 2019-12-25 00:40:22
问题 I'm following a SQL tutorial and am having trouble with this problem where I have multiple rows with the same order#-- how can I consolidate all rows with the same order# into just one row? So for example, in the screenshot, the first 2 rows are about "Jake Lucas" and have the same order#: what do I need to do to make these 2 rows into 1 row? Here's my code: SELECT firstName || ' ' || lastname "Name", customer#, order#, quantity, paideach, (quantity * paideach) "TOTAL", state FROM orderitems