In access I can make a query (1) that returns something
and make another query (2) that uses the first query (1).
How I can do it in Oracle 11g ?
thanks in advance
I am not an expert in Oracle but you should check out Views and Nested Views in Oracle.
In lack of more information about what to achieve, see the syntax of
Insert with Select and Subquery
Update Statements
Not sure what your question is, but you can use the WITH clause to create "views" within a query - no need to create a VIEW and in 11g you can use recursive sub-query using the WITH clause.
Related
Could anybody help me translate this query from T-SQL to PLSQL, please?
I am using SQL Developer.
UPDATE schema.Table SET PICTURES =(SELECT * FROM OPENROWSET (BULK '\\shared folder\Picture.jpg', SINGLE_BLOB) a) WHERE (personID = 1111)
Thank you!
It looks to me like you are trying to apply a single image to a single person table row by selecting from an image file external to the database.
If my understanding is correct then I suggest you investigate Oracle EXTERNAL TABLE, DIRECTORY object and DBMS_LOB package.
Using some variant of these will certainly provide the solution you need.
I'm running Apex 19.2 and I would like to create a classical or interactive report based on dynamic query.
The query I'm using is not known at design time. It depends on an page item value.
-- So I have a function that generates the SQL as follows
GetSQLQuery(:P1_MyItem);
This function may return something like
select Field1 from Table1
or
Select field1,field2 from Table1 inner join Table2 on ...
So it's not a sql query always with the same number of columns. It's completely variable.
I tried using PL/SQL function Body returning SQL Query but it seems like Apex needs to parse the query at design time.
Has anyone an idea how to solve that please ?
Cheers,
Thanks.
Enable the Use Generic Column Names option, as Koen said.
Then set Generic Column Count to the upper bound of the number of columns the query might return.
If you need dynamic column headers too, go to the region attributes and set Type (under Heading) to the appropriate value. PL/SQL Function Body is the most flexible and powerful option, but it's also the most work. Just make sure you return the correct number of headings as per the query.
I was originally using LISTAGG to do the union of strings in oracle.
Searching for PostgreSQL I get: string_agg
I don't know if there is any way to have a function that works in both applications.
I have to do it from the query since I can't create functions
thanks for your help
Thank you all for the help, in the end I did it through functions and sub-query
How can the following be done with a linq statement?
SELECT Description
FROM Production.ProductDescription
WHERE FREETEXT(Description, 'Some Keywords')
No, the full text search function FREETEXT in TSQL is not directly accessible with Linq to SQL.
You would have to execute that query directly in a database function, then you can pull your result set back with Linq to SQL.
I am not sure, but you might have to search each column/property of the table against your keyword to mimick freetext.
ex:
context.Production.ProductDescription
.Where(pd=>pd.Property1.Contains("Keyword") || pd.Property2.Contains("Keyword");
yesterday I've been trying to make this code work inspite the fact it's just working fine with nhibernate and SQL server but when it come to oracle it generate wrong sql
UnitOfWork.Current.CreateCriteria<Bill>().Add(Restrictions.IsEmpty("ReqId"))
.SetMaxResults(BatchSize).SetLockMode(LockMode.Upgrade).List<Bill>();
the generated SQL will something like
Select * from
(Select bill_0.id,bill_0.BillNo ...... from Bill bill_0 where bill_0.reqId is Not null )
where ROWNUM < 10 for UPDATE of bill_0.ID
so i wont run because the allies bill_o is defined inside the inner sql statement so who got the solution ?
the correct sql would be something like this which i tried and worked on oracle db
Select bill_0.id,bill_0.BillNo ...... from Bill bill_0
where bill_0.reqId is Not null and ROWNUM < 10 for UPDATE of bill_0.ID
Since, as you say, NHibernate is generating invalid Oracle SQL, I suggest you file a bug with the NHibernate people. The SQL would work if the in-line view had been assigned an alias of "bill_0", or if the FOR UPDATE clause didn't use a table alias ("for UPDATE of ID"). Whether you can modify your NHibernate calls to make either of these happen I'm afraid I have no idea.