SELECT SQLite statement failed
I've reached the point where I need to crowd source this error.
I try to run the following code:
uri = URI.create("file://" + _optionsData.getStorageURI() + OptionsData.DB_NAME); sqliteDB = DatabaseFactory.open(uri); Statement st = sqliteDB.createStatement("SELECT * FROM foo"); st.prepare(); Cursor c = st.getCursor(); Row r = c.getRow(); int size = r.getInteger(0);
Creates the URI end to the database of opening works very well. The statement is prepared. However, when I get the cursor, it is 'empty', containing no information line or column. c.getRow () returns a NULL reference and the following statement fails with a special Null pointer.
The SQL code has been checked with a SQLite spy program to the same database.
To check that I have all correct on the connection to the database, I changed the code to make an INSERT using st.execute (), and the values inserted in the database. Verified by SQLite Spy.
It will fail in the same way on the 9700 "Bold" standard simulator that comes with the Eclipse plugin and the specific Storm 2 Add-on Verizon Simulator.
Any suggestions?
Solved my problem.
The code snippet, before you start changing things to try to understand what wasn't in question a "SELECT MAX (id) foo" call. Thus, it only returns a single line.
I come from a background of Perl/MySQL, and I didn't know that when you have a line that is returned, you should always call the next() on a cursor before it will be initialized. Therefore, the above code should read as follows:
Statement st = sqliteDB.createStatement("SELECT MAX(id) FROM foo"); st.prepare(); Cursor c = st.getCursor(); if (c.next()){ Row r = c.getRow(); int size = r.getInteger(0); }
When c.next () is called, the cursor is on the first line.
Tags: BlackBerry Developers
Similar Questions
-
IMP-00017: statement failed with error ORACLE 1658:
# imp system/pass fromuser = touser = file=/disk1/Downloads/dmp/MI61015.dmp databaseName databaseName
Import: Release 11.2.0.2.0 - Production on Sat Oct 10 09:29:32 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11 g Express Edition Release 11.2.0.2.0 - 64 bit Production
Export file created by EXPORT: V11.02.00 by conventional means
import performed AL32UTF8 and AL16UTF16 NCHAR character set
Customer export uses the (possible character set conversion) US7ASCII character set
. imported objects from databaseName databaseName
. . import of table 'ACCOUNTS' 12 rows imported
. . table import 'AGREEMENTS' 6 imported lines
. . importing table "ASSIGNEDDEPT" 0 rows imported
. . import of 2713 lines imported from the table 'BULKSAVEDCVS '.
. . import of table "CERTIFICATION" 7 lines imported
. . importing table "COMMONDOCS" 0 rows imported
. . table import 'COUNTRY' 256 imported lines
. . importing table "CVCATEGORIES" 6 imported lines
. . table 'CVCERTIFICATION' import 92 lines imported
. . importing table "CVCHECKAGAIN" 56 imported lines
. . importing table "CVDETAILS".
IMP-00058: ORACLE error 1653
ORA-01653: unable to extend table databaseName.CVDETAILS 8192 in the SYSTEM tablespace
IMP-00028: partial import of the restored previous table: 20960 restored lines
. . table 'CVLICENSE' import 756 lines imported
. . importing table "CVPROPERTIES" 69752 imported lines
. . rows in table 'CVSPECIALTY' import imported 6159
. . import of 1701 lines imported from the table 'CVVIEWS '.
. . "DEPT" table import 2 lines imported
IMP-00017: statement failed with error ORACLE 1658:
' CREATE TABLE 'DETAILRESUME' ("D_ID" (14: 0), THE NUMBER OF 'CV_ID' (14: 0), "").
"NUMBER OF 'CAT_ID' (14: 0), 'DETAILRESUME' CLOB) INITRANS PCTUSED 40 PCTFREE 10.
1 MAXTRANS 255' STORAGE ' (INITIALS 67108864 THEN 1048576 MINEXTENTS 1 FREELIST).
"S 1 FREELIST GROUPS 1 DEFAULT USER_TABLES) TABLESPACE 'SYSTEM' LOGGING NOCO.
"COMPRESS LOB ("DETAILRESUME") AS STORE BASICFILE (TABLESPACE 'SYSTEM' ENABLE '.
"CHUNK 8192 PCTVERSION 10 NOCACHE LOGGING STORAGE (INITIAL 6" ONLINE STORAGE ".
"THE NEXT 5536 1048576 MINEXTENTS 1 FREELISTS 1 FREELIST GROUPS 1 USER_TABLES OF."
"FAULT)).
IMP-00003: ORACLE error 1658
ORA-01658: unable to create the INITIAL extent for segment in tablespace SYSTEM
. . importing table "DOCCATEGORIES" 0 rows imported
. . table 'EMPLOYERORAGENT' import 62 lines imported
. . table 'FAQ' import 4 lines imported
. . importing table "FOLDERCVS" 6 imported lines
. . table import 'FOLDERS' 3 imported lines
. . "JOBDETAILS" table import 84 lines imported
. . table 'JOBKEYWORDS' import 190 lines imported
. . table 'JOBPOSTINGS' import 84 lines imported
. . import of table 'JOBPROPERTIES' 89 imported lines
. . table 'JOBRESPONSES' import 64019 lines imported
. . table import "LICENSE" 20 imported lines
. . import of table 'MESSAGES' 0 rows imported
. . table import 'NEWS' 0 rows imported
. . table import "SPECIALTY" 301 lines imported
. . table import "STAFF" 12 rows imported
. . table import 'TICKET' 0 rows imported
. . importing table "TICKETCATEGORY" 0 rows imported
. . importing table "TICKETTEMPLATES" 0 rows imported
. . import of rows in table 'USERS' 4410 imported
About to activate the constraints...
Import completed successfully with warnings.
#
Please advise.
Thank you in anticipation
Christy H. wrote:
How can I increase its space?
That drive you some people to knowledge, but you can't make them think.
-
PS ask activetion again. the worm is first CS PS v8, it fails, I tried to call help number given on the page but service does not exist, it redirects to .../go/activation
statement fails it causes some assistance - activate is not possible to click
Adobe has disabled the server activation for pre CS3 products a long time ago and that's why you are unable to activate your product. I can not to suggest what to do, but I don't know that CS2 owners with this problem can download a version specially created that doesn't require activation. To my knowledge, no such version exists for CS. If it was me, then as the real owner of the software and just unable to use it due to having no mechanism to activate, I download CS2 and use it until someone from Adobe told me to stop. It is a sensitive issue because the download site clearly indicates that there must be an existing CS2 owner. However, the url to the download was posted the pirate not many Adobe Web sites not as a way to free download the CS2. I imagine that there have been hundreds if not thousands of downloads from 2013 when it became first available and so far Adobe has not made any attempt to restrict the download to current owners of CS2. Their policy is quite clear if CS2 is not given away for free. Fortunately, I use CC2015, I can't make a call on it, but the URL is below if you want to move forward.
Download Adobe Acrobat 7 and Adobe Creative Suite 2
Terri
-
Select Into statement in the function db - query issued schema table
problem with "select into" in the function db to point 10.2
There are two schemas. "mdbdev" is the master database, and 'devusr' is granted SELECT access table to run queries in the mdbdev schema.
with devusr, in SQL, I am able to run the following query
Select wm_concat (strConcatedCountryList)
from (select country_name as mdbdev.country_master mdbcm strConcatedCountryList
where mdbcm.country_ship_status = < param? >
order of country_name)
but when I use the same procedure/function with 'select into' motion, failed to compile with error * "table or view does not exist."
FUNCTION GETCOUNTRYLISTTOSHIP (SHIP_STATUS NUMBER)
RETURN VARCHAR2
IS
var2CountryList VARCHAR2 (1000);
BEGIN
Select wm_concat INTO var2CountryList (strConcatedCountryList)
from (select country_name as mdbdev.country_master mdbcm strConcatedCountryList
where mdbcm.country_ship_status = value < SHIP_STATUS >
order of country_name);
Return var2CountryList;
END;
Please advise/help/suggestion :)You don't have to ask for the DBA, you can run a query to find out:
select * from all_tab_privs_recd where owner = 'MDBDEV' and table_name = 'COUNTRY_MASTER'
What give you?
-
SQLite - Statement.prepare - DBException
Hi, when I try to prepare a statement I make DatabaseException
Statement st = database.createStatement ("select * from rutas");
St.Prepare ()--> DatabaseException
Database opens successfully, but... This database is created via the cmd console.
I did the same with a database created in the blackberry application with the method of demonstration database and work very well.
Suggestions?
I feel stupid now its solved now. I opened a different database, not the good database ...
Thank you.
-
4.1 EA1 select dropbox connection fails
Environment - OS X java 10.10.1, 8 u25 Yosemite.
If I open a window of sql and execute a statement, nothing seems to happen. If I use the dropbox to select another connection (top right of the window) I get the following error and the dropbox has now no connection.
java.lang.ClassCastException: oracle.dbtools.raptor.newscriptrunner.ScriptRunnerContext cannot be cast to oracle.dbtools.raptor.scriptrunner.GuiScriptRunnerContext
to oracle.dbtools.worksheet.editor.Worksheet$ ConnOpenListener.connectionOpened (Worksheet.java:1702)
to oracle.dbtools.worksheet.editor.ConnComboBox$ ConnectionTaskListener$ 2.run(ConnComboBox.java:358)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:744)
to java.awt.EventQueue.access$ 400 (EventQueue.java:97)
in java.awt.EventQueue$ 3.run(EventQueue.java:697)
in java.awt.EventQueue$ 3.run(EventQueue.java:691)
at java.security.AccessController.doPrivileged (Native Method)
in java.security.ProtectionDomain$ 1.doIntersectionPrivilege(ProtectionDomain.java:75)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:714)
at oracle.javatools.internal.ui.EventQueueWrapper._dispatchEvent(EventQueueWrapper.java:169)
at oracle.javatools.internal.ui.EventQueueWrapper.dispatchEvent(EventQueueWrapper.java:151)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
If I try to run the SQL without connection selected I get prompt to select a connection (which is what I expected) and when I select a connection error flashes but the statement executed, and I get results. Yet once the box is now no connection selected. Not sure whether I'm supposed to, otherwise I can create some screenshots. I see the same behavior if I open a sql script, try to run as a script and prompt for a connection - select one and get the error, but the script runs.
Bug 20199438 - STARTUP SCRIPT WILL BREAK CONNECTION FOR PLUG technical
Fixed. Will be available in the next version.
-
Try to run a SQL statement through the window of OEM 12 c run SQL. Statement fails
All,
I have a 11g database. When it is initially installed, I installed it in $ORACLE_BASE = / orabin/app/oracle/product and $ORACLE_HOME = $ORACLE_BASE/11gDB_R2. This is the version 11.2.0.1 to give birth to 11.2.0.3.
Recently, I installed 11.2.0.4 in $ORACLE_BASE/11.2.0.4. Then, I upgraded my database at 11.2.0.4. Everything works fine.
All my scripts on the linux host logon changed to point my environment at $ORACLE_BASE/11.2.0.4 House and my $PATH when I connect to the linux host is: /orabin/app/oracle/product/11.2.0.4/bin:/orabin/app/oracle/product/11.2.0.4/OPatch:/sbin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/oracle/bin
On my OEM Console, the database appears as 11.2.0.4 and me can manage very well.
However, when I try to use the window of the OEM Console to execute SQL to execute any type of SQL statement, it fails.
The failure error is:
Could not launch/orabin/app/oracle/product/11gDB_R2/bin/sqlplus-s/nolog: no such file or directory
It would be a mistake since the 11gDB_R2 directory tree (the 11.2.0.3 software) has been removed from the host, now that the database is set to level and working as 11.2.0.4.
I wonder if somewhere in the OEM software, there is always a pointer to the old ORACLE_HOME? I can't find anything in the .bashrc or other shell scripts that are executed when a Shell session on the host computer which were still the reference to the old directory of 11gDB_R2 so I'm a bit puzzled.
I have 8 guests, and all have been improved in the same way at 11.2.0.4. For some databases, the OEM window run SQL is executing the SQL code.
Someone has some ideas on this?
Go to the Configuration of the analysis of the database (when you set the password) and update of the Oracle home. Also do this for all targets listener on this host as well.
-
Hello
In the DEPENDENCIES of DBA, I can see that I have (seen here) according to some a table objects:
-SQL > select type, name
-2 from dba_dependencies where REFERENCED_OWNER = upper ('stuff')
--3 and REFERENCED_name = upper ('st_tab') and type = "VIEW";
-NAME OF THE OWNER TYPE
-- ----- ----- ------------------
-VIEW STUFF STTAB_4MV_VW
-VIEW STUFF STTAB_VW
But trying to recover these definitions 2 times I get an error:
-SQL > select dbms_metadata.get_dependent_ddl ('VIEW', 'ST_TAB', 'STUFF') def double;
-ERROR:
-ORA-31604: NAME parameter invalid "BASE_OBJECT_NAME" for the type of VIEW object in the function SET_FILTER
-ORA-06512: at "SYS." DBMS_SYS_ERROR', line 116
-ORA-06512: at "SYS." DBMS_METADATA_INT', line 4705
-ORA-06512: at "SYS." DBMS_METADATA_INT', line 8582
-ORA-06512: at "SYS." Dbms_metadata", line 2882
For some objects, it works (triggers, index), but for others (views, procedures, packages), it still fails with ORA 31604.
If I make a direct call on dbms_metadata.get_ddl ('DISPLAY', 'STTAB_4MV_VW', 'STUFF'), it works fine.
Everyone has seen this behavior before? (tried this code on 10g and 11g)
Thank you very much.
Kind regards
SEB
For some objects, it works (triggers, index), but for others (views, procedures, packages), it still fails with ORA 31604.
Exactly! That's what he should do. Dependent on DOF is for objects that are actually part of the table.
If I make a direct call on dbms_metadata.get_ddl ('DISPLAY', 'STTAB_4MV_VW', 'STUFF'), it works fine.
Exactly! That's how you get the DDL for views and other types of distinct objects. Provide you with the type of object as the first parameter.
Everyone has seen this behavior before? (tried this code on 10g and 11g)
Sure! This is a normal behavior.
See chapter doc DBMS_METADATA packages and Types
http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28419/d_metada.htm#i1019414
Notes on use
- These functions allow you to extract metadata for objects with a single call. They encapsulate calls to
OPEN
,SET_FILTER
, and so on. The function you use depends on the characteristics of the type of object and if you want the DDL or XML. GET_xxx
is used to fetch named objects, especially schema objects (tables, views).GET_DEPENDENT_xxx
is used to extract dependent objects (audits, grants of the object).GET_GRANTED_xxx
is used to retrieve issued objects (System of subsidies, scholarships of role).
- For certain types of objects, you can use more than one function. For example, you can use
GET_xxx
to fetch a name index, orGET_DEPENDENT_xxx
to fetch the same index by specifying the table on which it is defined.
See also table 74-11 in this doc for a table showing the types of objects.
http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28419/d_metada.htm#BGBIEDIA
- These functions allow you to extract metadata for objects with a single call. They encapsulate calls to
-
conditional select into statement
Hi people.I'm trying to implement a conditional block in a select statement. I browsed the forums and seen the suggestions with the DECODING and the recurrent insistence that IF/ELSE do not or cannot work within the PL/SQL, which is what it would be.
I'm trying to connect a simple string value if the value of a column is null. The block WHEN either does not either or I'm doing it wrong, but I would take any suggestions that you that you better informed than me on this.
Here is the block:
------------------
SELECT c.CHCTRLID 'CC ID', c.STATUS3, b.VPTIMSTAMP,
a.VP_DATE AS 'Submit Date', a.CRITI_EXP_DT AS 'Critical Date', c.REQ_TYPE, c.SUBJLETTER,c.PGCOUNT AS 'Total Page', c.EFFECT_PGCOUNT,
c.PUBTYPE AS "Type of Publication", c.COMPLEXITYLEVEL,.
c.PUBDATE, a.BRANCH, a.BRANCH_SEC, a.PRIORITY, c.WRITER, a.REQ_INFO_DESCRIPT, a.DEPT,ABS (Round ((pubDate-VPTIMSTAMP), 0)) AS 'level of SLA in days. "
-WHEN PUBDATE IS NULL
- then return "n/a" AS "secondary ALS."
-WHILE OTHERS THEN
-BACK Abs (Round (SYSDATE-VPTIMSTAMP), 0)) AS 'secondary ALS. "a.OPS_MAN_CHG, a.OPS_MAN_PPCHAP, a.STRATEGY_UPDATE, a.CRITICAL_EXP
B INNER JOIN CHG_CTRL_USR one CHG_CTRL_ADM
ON b.CHCTRLID = a.CHCTRLID
C INNER JOIN ADM_SUPP_INDX ON b.CHCTRLID = c.CHCTRLIDWHERE c.STATUS3! = 'Cancelled' AND a.VP_DATE > 4 April 11 '
ORDER BY a.CHCTRLID---------------------------
I commented on the block ONCE because it wouldn't work, but basically, that's what I'm trying to accomplish.
Thank you.
Decode is possible, but the CASE is more readable.
Try this as a column value
CASE WHEN PUBDATE IS NULL then 'n/a' else to_char(Abs(Round(SYSDATE-VPTIMSTAMP),0)) ) end AS "Secondary SLA",
second possibility to check NULL is use NVL or NVL2.
The data type of these two results must match.
as in
nvl2(PUBDATE, to_char(Abs(Round(SYSDATE-VPTIMSTAMP))) , 'n/a')
-
Select SQL statement - See all the value of the range of month of entry
Hi all
I have a vision that is a union of other views
But the description of the view is as below
-current data in the viewdesc dashboard_monthly_view Name Null Type ------------------------------ ---- ------------ MONTHS VARCHAR2(17) NUM_DEPENDENT_IN_ASSESSMENT NUMBER NUM_REFERRED_AODTC NUMBER NUM_AT_DETERMINATION_HEARING NUMBER NUM_ACCEPTED NUMBER NUM_NOT_ACCEPTED NUMBER NUM_EXITED_SUCCESS NUMBER AVERAGE_DAY_TO_EXIST NUMBER NUM_EXITED_UNSUCCESS NUMBER AVERAGE_DAY_TO_EXIST_UNSUCCESS NUMBER COURT_NAME VARCHAR2(9)
-My select query isMONTHS NUM_DEPENDENT_IN_ASSESSMENT NUM_REFERRED_AODTC NUM_AT_DETERMINATION_HEARING NUM_ACCEPTED NUM_NOT_ACCEPTED NUM_EXITED_SUCCESS AVERAGE_DAY_TO_EXIST NUM_EXITED_UNSUCCESS AVERAGE_DAY_TO_EXIST_UNSUCCESS COURT_NAME ----------------- --------------------------- ---------------------- ---------------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ------------------------------ ---------- AUG 2012 1 0 0 0 0 0 0 0 0 AAA OCT 2012 8 1 3 1 1 1 44 1 4 AAA SEP 2012 2 0 2 2 0 0 0 0 0 AAA *UNDEFINED* 0 11 7 1 1 0 0 1 0 AAA NOV 2012 0 0 0 0 0 0 0 1 54 BBB OCT 2012 4 1 2 1 1 1 9 0 0 BBB SEP 2012 1 0 0 0 0 1 14 0 0 BBB *UNDEFINED* 0 5 4 1 0 0 0 1 0 BBB AUG 2012 1 0 0 0 0 0 0 0 0 COMBINED NOV 2012 0 0 0 0 0 0 0 1 54 COMBINED OCT 2012 12 2 5 2 2 2 26.5 1 4 COMBINED SEP 2012 3 0 2 2 0 1 14 0 0 COMBINED *UNDEFINED* 0 16 11 2 1 0 0 2 0 COMBINED 13 rows selected
- And the result isDEFINE startmonth = "Aug 2012"; DEFINE endmonth = "Nov 2012"; with all_months as ( select to_char(which_month, 'MON YYYY') month from (select add_months(to_date('&startmonth','MON YYYY'), rownum-1) which_month from all_objects where rownum <= months_between(to_date(NVL('&endmonth', '&startmonth'),'MON YYYY'), add_months(to_date('&startmonth','MON YYYY'), -1)) order by which_month ) ) select nvl(months, '**ALL**') AS "MONTHS", TO_DATE(MONTHS, 'MON YYYY') AS MONTH_SORT , sum(num_dependent_in_assessment) AS num_dependent_in_assessment , sum(num_referred_aodtc) AS num_referred_aodtc , sum(num_at_determination_hearing) as num_at_determination_hearing , sum(num_accepted) AS num_accepted , sum (num_not_accepted) AS num_not_accepted , sum(num_exited_success) as num_exited_success , sum(average_day_to_exist) as average_day_to_exist , sum(num_exited_unsuccess) as num_exited_unsuccess , sum (average_day_to_exist_unsuccess) as average_day_to_exist_unsuccess from DASHBOARD_MONTHLY_VIEW right outer join all_months on DASHBOARD_MONTHLY_VIEW.months = all_months.month --where months in (select month from all_months) and upper(court_name) like 'AAA' group by (months) order by month_sort
-The requirement of results I have to produce isMONTHS MONTH_SORT NUM_DEPENDENT_IN_ASSESSMENT NUM_REFERRED_AODTC NUM_AT_DETERMINATION_HEARING NUM_ACCEPTED NUM_NOT_ACCEPTED NUM_EXITED_SUCCESS AVERAGE_DAY_TO_EXIST NUM_EXITED_UNSUCCESS AVERAGE_DAY_TO_EXIST_UNSUCCESS ----------------- ------------------------- --------------------------- ---------------------- ---------------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ------------------------------ AUG 2012 01/08/12 1 0 0 0 0 0 0 0 0 SEP 2012 01/09/12 2 0 2 2 0 0 0 0 0 OCT 2012 01/10/12 8 1 3 1 1 1 44 1 4 **ALL**
On the tota (* EVERYTHING *) l, I tried to use the rollup but he total average too, which is not correct. I think the reason because he cannot read the form that was used to calculate the column.MONTHS MONTH_SORT NUM_DEPENDENT_IN_ASSESSMENT NUM_REFERRED_AODTC NUM_AT_DETERMINATION_HEARING NUM_ACCEPTED NUM_NOT_ACCEPTED NUM_EXITED_SUCCESS AVERAGE_DAY_TO_EXIST NUM_EXITED_UNSUCCESS AVERAGE_DAY_TO_EXIST_UNSUCCESS ----------------- ------------------------- --------------------------- ---------------------- ---------------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ------------------------------ AUG 2012 01/08/12 1 0 0 0 0 0 0 0 0 SEP 2012 01/09/12 2 0 2 2 0 0 0 0 0 OCT 2012 01/10/12 8 1 3 1 1 1 44 1 4 NOV 2012 01/11/12 0 0 0 0 0 0 0 0 0 **ALL**
How can I fix this, should I create, select another below one, with the sum of each column and the average for the other columns.
Also, the business analyst want to show all the months between the start and end of the month.
I used the right outer join, but apparently does not produce the right result.
If anyone of you have any ideas, please advise.
We use Oracle 11 g, it is a select statement for an Oracle APEX report.
The APEX version is 4.0.2. I'm a junior developer of the APEX and I still have to learn a lot about SQL Oracle analytic function.
Thank you very much in advance.
AnnHi, Ann.
Ann586341 wrote:
... I created a table to contain a simplified version of this viewThank you. It is much easier to work with.
... My query is
DEFINE startmonth = "Aug 2012"; DEFINE endmonth = "Nov 2012"; with all_months as ( select to_char(which_month, 'MON YYYY') month from (select add_months(to_date('&startmonth','MON YYYY'), rownum-1) which_month from all_objects where rownum <= months_between(to_date(NVL('&endmonth', '&startmonth'),'MON YYYY'), add_months(to_date('&startmonth','MON YYYY'), -1)) order by which_month ) ) , tbl_dashboard_active as ( select * from tbl_dashboard_monthly where months != '**UNDEFINED**' ) select tbl.months AS "MONTHS" --, TO_DATE(tbl.MONTHS, 'MON YYYY') AS MONTH_SORT , tbl.num_hearing , tbl.num_exited_success , tbl.avg_day_success_exist , tbl.num_exited_unsuccess , tbl.avg_day_unsuccess_exist from tbl_dashboard_active tbl right outer join all_months am on tbl.months = am.month and upper(tbl.court_name) like 'BBB' UNION ALL select 'ALL' AS "TOTAL" , SUM(tbl.num_hearing) , SUM(tbl.num_exited_success) , round(AVG(tbl.avg_day_success_exist),2) , SUM(tbl.num_exited_unsuccess) , round(AVG(tbl.avg_day_unsuccess_exist),2) --order by to_date(am.month,'MON YYYY') from tbl_dashboard_monthly tbl right outer join all_months am on tbl.months = am.month and upper(tbl.court_name) like 'BBB'
- And the result I got
MONTHS NUM_HEARING NUM_EXITED_SUCCESS AVG_DAY_SUCCESS_EXIST NUM_EXITED_UNSUCCESS AVG_DAY_UNSUCCESS_EXIST ----------------- ----------- ------------------ --------------------- -------------------- ----------------------- AUG 2012 1 0 0 0 0 OCT 2012 1 0 0 2 35 SEP 2012 1 0 0 0 0 ALL 3 0 0 2 11.67
I don't know why even I already filter all lines that the month is undefined, I still have a blank line in the result set.
This is the line for November. You do an outer join, in order to ensure that each value of am.month is displayed, even if it does not match what anyone in tbl. When it does not match anything, then all the columns tbl is supposed to provide will be NULL. You decide to view tbl. months, which is one of the following columns will be NULL. You should display mod. monmth instead.
But if I run for handset Court, I don't see this problem. The reason is that the Court combined have given for all four months?
When you say "on behalf of the combined Court", do you mean the unconditional "upper (tbl.court_name) as"BBB "?
If Yes, that would explain it.Also is it possible to list all the months between the start and end month assuring the user even if the statistics are 0.
Once again, in the case of lines that are present, even if they do not have the status of outer join, all of these columns will be NULL. Use NVL to map these nulls to 0.
and how to sort the month
GROUP OF two expressions, which depend on each other: one for sorting and the other for display.
For the sort expression, you can use months as a DATE. (It seems that you have tried this, but commented on the ORDER BY clause in your query is before the FROM clause.) The ORDER BY clause is always at the end of the query, after the FROM clause.)
Another expression of sorting is the number you used to generate the first month. That's what I used below.Here's a way to get the results you requested:
WITH got_months AS ( SELECT TO_DATE ('&startmonth', 'Mon YYYY') AS startmonth_dt , TO_DATE ( NVL ( '&endmonth' , '&startmonth' ) , 'Mon YYYY' ) AS endmonth_dt FROM dual ) , all_months AS ( SELECT rownum AS month_num , TO_CHAR ( ADD_MONTHS ( m.startmonth_dt , ROWNUM - 1 ) , 'MON YYYY' ) AS months FROM got_months m CROSS JOIN all_objects WHERE ROWNUM <= 1 + MONTHS_BETWEEN ( m.endmonth_dt , m.startmonth_dt ) ) SELECT NVL ( am.months , 'All' ) AS months , SUM (NVL (tbl.num_hearing, 0)) AS num_hearing , SUM (NVL (tbl.num_exited_success, 0)) AS num_exited_success , AVG (NVL (tbl.avg_day_success_exist, 0)) AS avg_day_success_exist , SUM (NVL (tbl.num_exited_unsuccess, 0)) AS num_exited_unsuccess , AVG (NVL (tbl.avg_day_unsuccess_exist, 0)) AS avg_day_unsuccess_exist FROM all_months am LEFT OUTER JOIN tbl_dashboard_monthly tbl ON am.months = tbl.months AND UPPER (tbl.court_name) = 'BBB' GROUP BY GROUPING SETS ( (am.month_num, am.months) , () ) ORDER BY am.month_num ;
Again, I used two GROUP BY expressions: one for sorting, the other for display. These depend on each other, that is, given one, you could derive from each other, and it is not sensible to dependent ROLLUP GROUP BY expressions like that, so I used GROUPING SETS ROLLUP instead, so it would be only 1 rank of great aggregate (in other words, 'all').
Output:
` AVG_ AVG_ NUM_ DAY_ NUM_ DAY_ NUM_ EXITED_ SUCCESS EXITED_ UNSUCCESS MONTHS HEARING SUCCESS _EXIST UNSUCCESS _EXIST --------- ------- ------- ---------- --------- ---------- AUG 2012 1 0 0 0 0 SEP 2012 1 0 0 0 0 OCT 2012 1 0 0 2 35 NOV 2012 0 0 0 0 0 All 3 0 0 2 8.75
-
'Go to the State' vs 'Go to the next State' for the selected button state
I have a series of image galleries in my publication that uses MSOs and buttons to "Go to another" - the thumbnails then have a small edge to have indicated that they are 'selected' - it works very well. The border is added to the click for each thumbnail button state.
I have a similar scenario is a YouTube embed of the video and an article as a MSO with two States: a State is the vid to youtube and the other State is the article of the text. I have a set place button to switch between these two States. This button is set to "Go to the next State" so he'll just between the two States MSO. Is there any way to have a selected State for this button so that the words under the button change to 'play' video in 'see article' while keeping this button set to "Go to the next State" - the only way I can think to do is with two buttons.
I realize, this is a very specific use case and I do not expect the features, but if there is a solution I am curious to know if anyone else has come across this.
Thanks in advance for your help.
Implement for the buttons in the different States. Then add an invisible button on it to the next State meetings.
Bob
-
Selecting correct state in the drop-down list.
Here is my delima. I have a form that gets repopulate when users come back to update their contact information. Name, address, etc. of the State. What I am having a problem with performs their State to be selected from a drop-down list. For example, if I'm from Ohio, so I want Ohio selected in the drop-down list. I don't want the user to have to select again the State if the information has not changed. Here's an example of how it is formatted.
< select tabIndex = "5" name = "State" >
< option value = "" selected = "selected" > < / option > "
< option value = 'AL' > Alabama < / option >
< option value = "AK" > Alaska < / option >
< option value = "AZ" > Arizona < / option >
< option value = "AR" > Arkansas < / option >
< option value = "CA" > California < / option >
< option value = "CO" > Colorado < / option >
Of course, the two-letter abbreviation is written and retrieved from the database.
Everyone works with this before?
Any help/information is appreciated.
BrianHere's how I made this...
Top of the page put
Then, when comes the time to put the list do that...
I hope this helps.
-
I try to use select statement in html, but it gives an error which is
16:50:21 PLS-00103: encountered the symbol "SELECT" at the expected in the following way:
16:50:21 PLS-00103: encountered the symbol "|"
' < html >
< table border = "1" >
< tr bgcolor = "Light Blue" >
< td > < b > ' | Select disconnect_cause in the rawticket_voip. "< /b > < table >
< td > < b > COL2 < /b > < table >
COL3 < td > < b > < /b > < table >
< /tr >
< /table >
< / html > "
How can I put a column it?It works for me and I get the email
CREATE OR REPLACE PROCEDURE SEND_EMAIL IS V_FROM VARCHAR2(80) := '[email protected]'; V_RECIPIENT VARCHAR2(80) := '[email protected]'; V_SUBJECT VARCHAR2(80) := 'test subject'; V_MAIL_HOST VARCHAR2(30) := 'localhost'; V_MAIL_CONN UTL_SMTP.CONNECTION; CRLF VARCHAR2(2) := CHR(13) || CHR(10); CURSOR CUR_ IS SELECT DISCONNECT_CAUSE FROM RAWTICKET_VOIP; W_DATA VARCHAR2(31000); BEGIN V_MAIL_CONN := UTL_SMTP.OPEN_CONNECTION(V_MAIL_HOST, 25); UTL_SMTP.HELO(V_MAIL_CONN, V_MAIL_HOST); UTL_SMTP.MAIL(V_MAIL_CONN, V_FROM); UTL_SMTP.RCPT(V_MAIL_CONN, V_RECIPIENT); W_DATA := '
'; FOR C IN CUR_ LOOP W_DATA := W_DATA || ' ' || C.DISCONNECT_CAUSE || ' '; END LOOP; UTL_SMTP.DATA(V_MAIL_CONN, 'Date: ' || TO_CHAR(SYSDATE, 'Dy, DD Mon YYYY hh24:mi:ss') || CRLF || 'From: ' || V_FROM || CRLF || 'Subject: ' || V_SUBJECT || CRLF || 'To: ' || V_RECIPIENT || CRLF || 'MIME-Version: 1.0' || CRLF || 'Content-Type: text/html; charset="us-ascii"' || CRLF || W_DATA || ' -
Select a statement creating problem
Hi guys!
I am trying to build a select statement as follows:
SELECT name, age, country
People
WHERE
THERE ARE
(SELECT cu.name, cu.age
CUSTOMER cu
WHERE
Cu.Name LIKE '% Mike % '.
AND cu.country LIKE '% two % '.
)
as you can see I'm trying to get the name, the age... of a table when these data exist in another table, the problem is that I need to do it this way, I can not change the name of the PEOPLE table or add an alias, I think I should add something like would take him IN, but I don't remember how to do it.
If anyone can help me it would be much appreciated.
THXClause EXISTS needs a subquery related Co. You will need to create a join between the table 'people' and 'customer '.
WHERE
THERE ARE
(SELECT cu.name, cu.age
CUSTOMER cu
WHERE
Cu.Name LIKE '% Mike % '.
AND cu.country LIKE '% two % '.
AND CU.NAME = PEOPLE.NAME
AND CU. AGE = PEOPLE. AGE
)Otherwise, you could use operator as
WHERE
(NAME, AGE) IN
(SELECT cu.name, cu.age
CUSTOMER cu
WHERE
Cu.Name LIKE '% Mike % '.
AND cu.country LIKE '% two % '.
) -
Query internal within a select if statement
I would like to know how to write an if condition inside a select statement of the present
I mean something likeb.inventory_item_id in( select distinct inventoryid from lcm.sis_inventario_new where fec_envio > to_date('28/01/2010','DD/MM/YYYY'))
select b.inventory_item_id as id, b.segment1 as c, b.segment2 as "Código", b.description as "Descripción", tl.description as "Descripción Larga", b.attribute1 as "Descripción Corta", c.segment1 as "Departamento",c.segment2 as "Familia", c.segment3 as "Subfamilia", b.creation_date as "Creado", b.INVENTORY_ITEM_STATUS_CODE as "Status", case b.attribute5 when '4' then 'Si' else 'No' end as "Pesado", case b.inventory_item_id when in select distinct inventoryid from lcm.sis_inventario_new where fec_envio > to_date('28/01/2010','DD/MM/YYYY')) then 'Si' else 'No' end as "Existe"
There are a number of ways, and the best solution for you will depend on several factors, including the index, the number of rows in the tables, etc..
Go using analytical functions;
with b as ( select rownum inventory_item_id from dual connect by rownum <=2), lcm as ( select 1 inventoryid, to_date('28/01/2000', 'DD/MM/YYYY') fec_envio from dual union all select 1, to_date('31/12/2010', 'DD/MM/YYYY') from dual union all select 2, to_date('28/01/2000', 'DD/MM/YYYY') from dual union all select 2, to_date('28/01/2008', 'DD/MM/YYYY') from dual) select b.inventory_item_id id, case when max(fec_envio) over(partition by b.inventory_item_id) > to_date('28/01/2010', 'DD/MM/YYYY') then 'Si' else 'No' end as existe from b, lcm where b.inventory_item_id = lcm.inventoryid; ID EXISTE ---------- ------ 1 Si 1 Si 2 No 2 No
Maybe you are looking for
-
I had my windows crash, but was able to restore with built-in software. One of the problems I was with was that all my default search in the search bar engine have been replaced by three (which no do I had previous) food, IMdB, and SiteAdvisor. When
-
Password at startup TECRA R950
I haveThe school where I work have a TECRA R950When I boot the laptop I have a password (it is not a bios password) but I do not knowHow can I reset this password?Thanks for the reply
-
Subscribe to the news FEED in Thunderbird
When I go to an RSS feed on a website I get given the pop - up "Subscribe to this feed using..." option "and Thunderbird in the drop-down menu options. When I click on Subscribe that everything that happens is it switched to Thunderbird but no flow a
-
Vista search causes Windows Explorer to close unexpectedly
Several recent research of Vista have caused Windows Explorer to close unexpectedly; no suggestion, no results, just endless search followed by a short message. The dialog box and in the search window, then close. I am running Vista Home Premium on a
-
Hello. I want to upgrade the ram on my laptop HP Pavilion g7 - 1010ev. It has 3 GB. Can I put 8 gb 1333 Mhz or 1066 Mhz?