Can we acquire locks on views in EDB PAS? - view

So I want to acquire a lock on a view existing in EDB Postgres for which I am having select as well as update privileges. I am getting an error when trying to run below query :
select * from view_name for update of view_name;
ERROR: FOR UPDATE cannot be applied to the nullable side of an outer join
Can someone tell if it is possible to use FOR UPDATE with views in EDB Postgres? And if yes, please tell how.
Thanks in advance,
Rohit

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.

Does TOAD for oracle generate logs of executed SQL?

I cannot seem to find a view which I created in one of my schemas within TOAD. Lets assume I don't know the exact schema in which I've created it, is there any way where I can find all the create statements which have been executed within a period of time, lets say the last days.
Thank you in advance.
If you created the view, just query ALL the views, and order by the date in which it was created.
select * from dba_objects
where object_type = 'VIEW'
order by created desc, last_ddl_time desc
We're hitting DBA_ views to make sure we look at EVERYTHING, not just the things you have PRIVS for. Switch to ALL_ views in case you lack access, and hope you didn't create the view in a schema in which your current logon can't see.
The other way to go is query the views themselves and key in on the table you think you included in the SQL behind the view.
SELECT *
FROM dba_views
WHERE UPPER (text_vc) LIKE '%EMPLOYEES%';
You might be looking for a feature called "SQL Recall" in Toad. Press F8 or View/SQL Recall. It will show you the SQL you ran in the last month or so.

Deadlock when creating a materialized view

I am trying to create a materialized view in oracle (with sql developer).
I have tested it on a small table and everything went ok.
Now i am doing it on a very big table, and after some hour of elaboration i get the following error:
"ORA-04020: deadlock detected while trying to lock"
Is there a way to avoid it? Or can't do much since the table is too big?
Something else in your database has an object locked that your query needs in order to be built.
To find out which object try;
SELECT vo.object_id, obj.object_name, vo.oracle_username, vo.os_user_name, vo.session_id
FROM v$locked_object vo
INNER JOIN all_objects obj
ON vo.object_id = obj.object_id
Look for objects that your materialized view will be trying to use and you should see which user has the object locked.
Go to the user and ask them to commit or rollback whatever they are doing.

Crystal reports not connectiing to Views from AS/400 IFS

I have a strange case here. I created a View in AS/400. I need to have view not join logical because I need to do a UNION ALL. The view is created and I went to IFS and granted permissions ALL. But when I open Crystal Reports, make the connection to iSeries, and go to that library of the View, it is not showing, so I cannot use.
Is there anything else I need to do?
I just tried something else. this is the view:
CREATE VIEW MKLIB/BEMPLOCM AS
((SELECT LMRIDC, LMCOM#, LMWHS#, LMLOC1, LMLOC2, LMLOC3, LMLTPC, LMLCT1
FROM
((SELECT LMRIDC, LMCOM#, LMWHS#, LMLOC1, LMLOC2, LMLOC3, LMLTPC, LMLCT1
FROM ASTDTA/ICLOCMLM WHERE LMLTPC IN ('PCK', 'PAL', 'RAK')) t1
EXCEPTION JOIN
(SELECT * FROM ASTDTA/ICBALMIE) t2
ON LMLOC1=IELOC1 AND LMLOC2=IELOC2 AND LMLOC3=IELOC3 )
EXCEPTION JOIN
(SELECT * FROM ASTDTA/ICBLDTIR) t3
ON LMLOC1=IRLOC1 AND LMLOC2=IRLOC2 AND LMLOC3=IRLOC3 ))
Now in Crystal reports there is also COMMAND to use to get your data, there you can make the same query but although I want it on the AS/400 for time consideration, the union is needed otherwise i have to run the queries via CL all day. SO I took the above code from the SELECT point, and got this error:
failed to retrieve data from the database. Details: HY000 IBM ISeries
ACCESS ODBC DRIVER (DB2 UDB) sql 5016 - Qualified object name ICLOCMLM
not valid. Vendor code 5016.
Not sure what that means.
Use the GRANT statement to control SQL privileges.
If the view is over regular files you may also have to use the commands GRTOBJAUT, EDTOBJAUT and RVKOBJAUT to modify authorization on those objects.
"It does not list it in the library when I see the tables and views in crystal."
Are you sure that the view is actually in the library you think?
What may have happened is that it may have been created in another library. Try checking in QGPL library, or if you have a library that matches your user profile name, check there.
If the question is 'Why do I get Qualified object name ICLOCMLM not valid.' the answer is probably that you are using *SQL naming and the statement you are running is using *SYSTEM naming. Try changing FROM ASTDTA/ICLOCMLM to FROM ASTDTA.ICLOCMLM and see if the 5016 error goes away.

how I can get log from database in oracle?

Last day my head judge me because he face with some problem that he didnot has it before!
but I didnt do any thing with database and also our company CM database is so critical !
In this case can he proof what I do with database???
Oracle have any log!
some functaion updating in last 2days that I didnt update it and he also...
please help me,how I can proof who do the mistake.
how I can find who with which user connect to database and update or change some thing...
You can see when database objects were last modified (recompiled/altered/created) this way:
SELECT object_name, last_ddl_time
FROM dba_objects
ORDER BY last_ddl_time DESC;
There are redo logs (which are used to recover from a backup), but they don't record the username, workstation or anything else that identifies who made a data change.

Resources