Strange results with in Oracle Apex using Pivot showing nulls and n - oracle
Im running a oracle 11g with Apex 4.2.6. Im trying to run a script but giving back nulls in apex but showing correct results in SQL developer
select "ENG_ID","ENG_ID1","roles","Region","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15" ,"16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31" from (
select M.ENG_ID as ENG_ID,
M.ENG_ID as ENG_ID1,
e.ROLE_ID as "roles",
e.REGION_AREA_ID as "Region",
EXTRACT(DAY FROM M.MS_DATE) as DOM,
MD.MD_ID
--MD.JOB_TYPE_ID
from MD_TS_DETAIL MD,
MD_TS_MAST M,MAN_ENGINEERS e
where
m.eng_id = 542 and
M.ENG_ID = e.ENG_ID and
M.MAST_ID=MD.MD_ID and
M.MS_DATE between trunc(sysdate,'MM') and last_day(sysdate)
)pivot (
max(MD_ID)
for DOM in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31)
)
which gives me the correct result of
SQL Dev view
Yet running the same script within Apex you get nulls.
apex view.
I'm completely stumped do you guys have any ideas
Ok after checking what the max records where both records where both on APEX and the database directly.
. In SQL workshop > selected MD_TS_MAST > statistics > analyse > estimate statistics change to 100% > next >finish.
all records came back. Why apex did not run from the database directly I don't know. So basicily if doing inserts in SQL developer, You must do a update via analyse.
Related
Can't get Oracle SQL Developer to display specific values from object table
I've started learning SQL and playing with Oracle SQL Developer v22. For some reason I'm not able to retrieve value from an object table by using SELECT VALUE(A). It only gives my user ID.object_name as in the below screenshot. Any tips why? SELECT VALUE(A) FROM table A; If I use SELECT * FROM table; all is fine. SELECT * FROM table A; I've tried printing using dmbs_output, same problem. Tried with other object tables, same behaviour.
Please share your table DDL and DML for a more accurate answer, but setting this preference should do what you're looking for 'Display Struct Value in Grid' I talk about that here Disclaimer: I work for Oracle and am the product manager for SQL Developer.
Selecting all User Created Tables in ORACLE
I am using Oracle Xpress Edition. I want to know how to select only user created tables in Oracle DB.? I am using this query: select * from user_tables; But it showing 24 rows. But i have only created 6 table.I don't know why & from where other tables (like APEX$_WS_FILES,DEPT, DEMO_USERS,APEX$_ACL,, APEX$_WS_HISTORY, etc) are showing. How to avoid those useless table.?
These tables were presumably created during any Oracle APEX related installation. You can use the below steps to get rid of them. SELECT * FROM ALL_OBJECTS WHERE OBJECT_TYPE = 'TABLE' AND OWNER = 'your_user' ORDER BY created; As these tables have been installed via an application, they most probably have been installed in a small and coherent time window. What I mean here is that probably they have been installed within a time frame of 30 mins, 1 hr or so. So if you order them by creation time, they will all flock to consecutive rows in the output of above query. Identify the time frame in which they have been started and finished installing those tables. Write the above query once again to filter that time frame out. You are then expected to get only your tables.
Oracle Apex Get Set Variable from datepicker
Oracle Apex 4.2 Oracle 11g Below is some SQL that generates an interactive report. I have 2 pages items both are date pickers named :P55_STARTD and P55_ENDD. I've also have a button to fire a refresh on all the report region. But still get nothing. I thing this is some type of session issue. Any ideas guys. Select * from (SELECT REPORT_MISSED_ORDERS_ALL.CUSTOMER_REF, REPORT_MISSED_ORDERS_ALL.LINE_NO, REPORT_MISSED_ORDERS_ALL.SKU, REPORT_MISSED_ORDERS_ALL.PICK_FROM, REPORT_MISSED_ORDERS_ALL.ORDERED_BY, REPORT_MISSED_ORDERS_ALL.HR, REPORT_MISSED_ORDERS_ALL.ORDER_PLACED_DATE, TO_CHAR(REPORT_MISSED_ORDERS_ALL.ORDER_PLACED_DATE, 'MONTH') AS months, LOGI_ORDERS.AUTH_TYPE_ID FROM REPORT_MISSED_ORDERS_ALL LEFT JOIN LOGI_ORDERS ON REPORT_MISSED_ORDERS_ALL.CUSTOMER_REF = LOGI_ORDERS.CALLNUMBER AND REPORT_MISSED_ORDERS_ALL.LINE_NO = LOGI_ORDERS.LINE_NUMBER)t1 where T1.AUTH_TYPE_ID is null and trunc(t1.ORDER_PLACED_DATE) between :P55_STARTD and :P55_ENDD ;
Have you put date items in "Page items to submit" field?
How to have sysdate result remoted across database link?
I'm running a query across a database link to a Sybase server from Oracle. In it's where clause is a restriction on date, and I want it tied to sysdate, so something like this: select * from some_remote_view where some_numeric_key = 1 and some_date > sysdate+2 The problem is, when I do explain plan, only the condition some_numeric_key = 1 shows up in the actual sql that is getting remoted to the sybase server. Oracle is expecting to perform the date filter on its side. This is causing a performance nightmare - I need that date filter remoted across to have this query working quickly Even if I try something like casting the sysdate to a charcater string like this: to_char(sysdate-2,'YYYY-MM-DD') It still does not remote it. Is there anything I can do to get Oracle to remote this date filter across the db link to Sybase?
Doing integration between Oracle and other platforms I often run into this problem, not just with SYSDATE but with other non-standard functions as well. There are two methods to work around the issue, the first being the most reliable in my experience. First, you can create a view on the remote db with the filters you need, then on the Oracle side you just select from the new view without additional filters. Second, if you are not allowed to create objects on the remote side, try using bind variables (of the correct data type!) in your Oracle SELECT statement, e.g.: declare v_some_date constant date := sysdate + 2; begin insert into oracle_table (...) select ... from remote_table#db_link t where t.some_numeric_key = 1 and t.some_date > v_some_date; commit; end; /
Oracle V$Session.SQL_ID is not populating
My organization recently upgraded form Oracle 10g to 11g. I had the following query that was working, but it no longer works because the V_$SESSION.SQL_ID field is not populated to link to. SELECT SESS.OSUSER ,SESS.MACHINE INTO v_USERID ,v_USERNAME FROM SYS.V_$SQLAREA SEQL JOIN SYS.V_$SESSION SESS ON SEQL.SQL_ID = SESS.SQL_ID WHERE SEQL.SQL_TEXT LIKE 'DELETE%' AND SEQL.SQL_TEXT LIKE '%ACCTLOG%'; Is there a work around I could use to obtain the same information? Thanks all