Question the use of Oracle query Variables

Hello

I am new to Oracle, I tried to extract the data from the Oracle database by using the following query which includes 1 variable SYSDATE_UTS, but when I try to execute the query I get an error. Please let me know what I am doing wrong and how I can fix.

Error message
-----
ORA-06550: line 4, column 1:
PLS-00428: an INTO clause in this SELECT statement
-----

Oracle query

DECLARE SYSDATE_UTS NUMBER: = (sysdate-to_date('19700101','yyyymmdd')) * 86400;
BEGIN

SELECT
INCIDENT_NUMBER,
TO_DATE (to_char ((1/86400 * REPORTED_DATE) + to_date ('19700101', 'YYYYMMDD'), "jj/mm/aaaa hh24:mi:ss"), 'hh24:mi:ss dd/mm/yyyy') as REPORTED_DATE_TIME,
GROUP_TRANSFERS
LAST_MODIFIED_BY
, to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 * LAST_MODIFIED_DATE, "mm/dd/yyyy hh24:mi:ss"), 'hh24:mi:ss dd/mm/yyyy') as LAST_MODIFIED_DATE
, (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 * SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) age
CASE
WHEN (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 * SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) BETWEEN 0 AND 1, THEN ' 0 - 1 days
WHEN (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 * SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) BETWEEN 2 AND 4 and THEN 2-4 days
WHEN (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 * SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) BETWEEN 5 AND 9, THEN 5-9 days
WHEN (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 * SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) BETWEEN 10 AND 19, THEN 10-19 days
WHEN (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 * SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) > 20 THEN ' Days 20 + ".
ANOTHER "UNKNOWN".
END AS AGE_GROUP
OF IncidentDataBase
and the STATE not in (4,5,6)
and rownum < 10;
END;

If you run this query in sql * plus you can declare a sql * more variable, assign a numeric value according to 'now' and use in your application, i.e.

SQL > variable NUMBER of SYSDATE_UTS;
SQL > exec SYSDATE_UTS: = (sysdate-to_date('19700101','yyyymmdd')) * 86400;

You would then call your request, referring to sql * more variable with a colon as SYSDATE_UTS prior to it (i.e.: SYSDATE_UTS)

SELECT
INCIDENT_NUMBER,
TO_DATE (to_char ((1/86400 * REPORTED_DATE) + to_date ('19700101', 'YYYYMMDD'), "jj/mm/aaaa hh24:mi:ss"), 'hh24:mi:ss dd/mm/yyyy') as REPORTED_DATE_TIME,
GROUP_TRANSFERS
LAST_MODIFIED_BY
, to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 * LAST_MODIFIED_DATE, "mm/dd/yyyy hh24:mi:ss"), 'hh24:mi:ss dd/mm/yyyy') as LAST_MODIFIED_DATE
, (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 *: SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) age
CASE
WHEN (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 *: SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) BETWEEN 0 AND 1, THEN ' 0 - 1 days
WHEN (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 *: SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) BETWEEN 2 AND 4 and THEN 2-4 days
WHEN (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 *: SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) BETWEEN 5 AND 9, THEN 5-9 days
WHEN (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 *: SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) BETWEEN 10 AND 19, THEN 10-19 days
WHEN (to_date (to_char (to_date ('01011970 ', 'ddmmyyyy') + 1/24/60/60 *: SYSDATE_UTS, ' mm/dd/yyyy'), ' mm/dd/yyyy'))-(to_date (to_char (+ to_date('19700101','yyyymmdd') + 1/86400 * REPORTED_DATE, ' mm/dd/yyyy'), ' mm/dd/yyyy')) > 20 THEN ' Days 20 + ".
ANOTHER "UNKNOWN".
END AS AGE_GROUP
OF IncidentDataBase
and the STATE not in (4,5,6)
and rownum<>

Table stores IncidentDataBase the "dates" in the number of seconds since the epoch unix?

Tags: Database

Similar Questions

  • Creation of data Mart: OWB, SSIS or the use of Oracle?

    I'm working on creating a data mart as a new application for my work. I am a developer pl/sql, but I have no experience in DW. I am looking at what technology to implement this. Each instance of the project for which I work is quite complicated to deploy. Therefore, the easiest way.

    Could someone advise me on the use of Oracle Warehouse Builder? be useful to use it to create a simple data mart?

    Could I have all of the features needed in a mini - data warehouse by simply using jobs of oracle for the planning of the ETL process created in pl/sql (bulk collect) without using another tool? Is this possible? We do not want to use SSIS.

    The DB is 10g EE R10.2.0.1.0, but we could move to 11g as needed

    Help with that I will be grateful.
    Concerning

    You can surely OWB to create simple to complex datamarts or Data Warehouse of company.
    For more information you can check out the link below

    https://forums.Oracle.com/forums/Ann.jspa?annID=1667

  • Monitoring of the use of Oracle dialog

    Hello

    After installing JDeveloper 11.1.1.5.0 (and other versions of 11g before that) and from JDeveloper for the first time, a "Oracle use Tracking" dialog box appears with the message
    "In order to continuously improve our products, Oracle is interested in learning about the use of the product. To this end, automatic reports can sometimes be sent to Oracle describing the characteristics of the product in use. No personally identifiable information will be sent and the report does not affect performance. You can view the privacy policy of Oracle on our site. "
    and a checkbox "allows the use automated Oracle."
    See the screenshot at http://www.consideringred.com/files/oracle/img/2011/OracleUsageTracking111150.png

    -(q1) where more details on this feature, such as what information it sends exactly, and when?
    -Oracle (q2) has published everything regarding the results of this 'Use Tracking' feature?

    Thank you very much
    Jan Vervecken
  • Getting the line without the use of hierarchical query values

    Hi all


    I want to know the hierarchical values without using a hierarchical query. I have two tables EMP, DEPT

    EMP table is to have two columns (empid, mgrid)
    DEPT table is to have two columns (deptid, empid)

    Data of the EMP

    1,
    2, 1
    3, 2
    4, 3

    Data DEPT

    10, 1

    Each time, I gave deptid = 10, I need to know the this deptid empid then who is this empid (child levels as well). In this case, the output should be
    1
    2
    3
    4

    I don't want to use hierarchical query.

    Thanks in advance.


    Thank you
    PAL

    You can use the RECURSIVE subquery, if you are 11 GR 2, like this

    SQL> with EMP (empid,mgrid) as
      2  (
      3  select 1,null from dual union all
      4  select 2, 1 from dual union all
      5  select 3, 2 from dual union all
      6  select 4, 3 from dual
      7  ),
      8  dept(deptid,empid) as
      9  (
     10  select 10, 1  from dual
     11  ),
     12  t(empid,mgrid) as
     13  (
     14  select empid,mgrid
     15  from emp e
     16  where empid in (
     17      select d.empid
     18      from dept d
     19      where deptid = 10
     20                  )
     21  union all
     22  select e.empid,e.mgrid
     23  from emp e, t
     24  where e.mgrid = t.empid
     25  )
     26  select *
     27  from t;
    
         EMPID      MGRID
    ---------- ----------
             1
             2          1
             3          2
             4          3
    

    Yet, the question is valid - why can't use you a hierarchical query?

    Published by: JAC on May 29, 2013 12:37

  • Question the use of the certificate for ODSEE 11.1.1.7.0

    Hello

    I have a few questions about certificates.

    (1) do I need to renew the original self-signed certificates created when the DS was created, if I'm not currently using the secure port?

    (2) do you have any suggestions as to a good resource to explain the use and implementation of certificates in ODSEE?

    Thank you

    Bill

    Hello

    Use of ldaps (LDAP over SSL) is optional, so no need to renew the certificates if you do not use encryption to access or LDAPS attribute

    Certificates are used with SSL for secure LDAP channel. SSL implementation used by Department based on NSS https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS

    Sylvain

    Please mark this answer as correct or helpful, when it is appropriate to make it easier for others to find

  • 'CREATE JAVA' error: ORA-29506: derived from the USING clause invalid query

    Hello

    I created a table with the following attributes:

    name varchar2 (200);
    LOB_DATA blob


    I loaded a java source file in the lob_data blob.

    I then called the SQL:

    create or replace and compile the java source named "RemoteCommand" using blob
    Select lob_data from str_blob_table where name = 'RemoteCommand.java ';

    and I get the error:

    ORA-29506: invalid query from the USING clause
    ORA-00936: lack of expression
    29506 00000 - "query invalid derived from USING clause.
    * Cause: The USING clause does not form a valid query.
    * Action: Correct the USING clause.



    If I simply copy and paste the query part of the USING clause:

    Select lob_data from str_blob_table where name = 'RemoteCommand.java ';

    I get a valid result in SQLDeveloper.


    Any thoughts on what is happening here?

    A few notes:
    1. it is a 8i database.
    2. it works very well on a 9i database, but according to the SQL reference for 8i, it should work as well.

    Thank you
    Brent

    Try to delete "select" in the USING clause, that is to say change the SELECT BLOB SUPPORT... for BLOB to HELP... The original form of the syntax of JAVA to CREATE did not expect the SELECT token must be explicitly provided. Somewhere between 8i and 9i the parser was changed to try the provided text as well as what, with SELECT prefixed. So a CREATE JAVA statement you tried working in 9i but in 8i fails because SELECT would always be added before you try using the clause as a query, resulting a SELECT duplicate token.

  • rules of the clues in the text and oracle query using matches

    Dear all,

    I would like to ask questions about the function of rules and matches the oracle text.
    I followed a lead in the oracle text application developer guide.
    I have a table of rules like this:

    1 oracle
    2 larry or ellison
    3 oracle and text
    market share 4

    Then I create an index in this table. This is necessary for the matches function call. Here's the syntax:

    create index queryx on queries (query_string)
    indexType is ctxsys.ctxrule;

    Then, I noticed that the result on DR$ QUERYX$ I table as follows:

    0 2 2 1 LARRY (BLOB)
    MARKET 0 4 4 1 (BLOB) {MARKET} {ACTION}
    0 1 1 1 ORACLE (BLOB)
    0 3 3 1 ORACLE (BLOB) {TEXT}
    0 2 2 1 ELLISON (BLOB)

    What I want to ask is why do the words 'share' and 'text' appear in the DR table $ QUERYX$?

    When we use the function of the matches, it can search on the result of the index and therefore he walls can't find the word 'action '. Thus, when for example I ask like this:

    Select query_id queries where matches (query_string, "it only to share ten percent of all products sold") > 0

    It will give 0 results since no words in "it only to share ten percent of all products sold ' was in the index table. But in fact it could possibly be classified as category 4 rules which is "market share".

    I tried this in a large data set and get the same result.
    Here are my rules generated from my collection of document:

    1 {REQUIREMENTS of} & {ELICITATION}
    1 {REQUIREMENTS of} ~ {ELICITATION} & {ACTOR}
    1 {REQUIREMENTS of} ~ {ELICITATION} ~ {ACTOR} & {FURPS}
    1 {REQUIREMENTS OF} ~ {ELICITATION} ~ {ACTOR} ~ {FURPS} ~ {OUTLINE}
    1 {REQUIREMENTS of} ~ {ELICITATION} ~ {ACTOR} ~ {FURPS} ~ {OUTLINE} & {PROC}
    1 {REQUIREMENTS of} ~ {ELICITATION} ~ {ACTOR} ~ {FURPS} ~ {OUTLINE} ~ {PROC} & {SPEED}
    1 {REQUIREMENTS of} ~ {ELICITATION} ~ {ACTOR} ~ {FURPS} ~ {OUTLINE} ~ {PROC} ~ {SPEED} & {PDF}
    1 {REQUIREMENTS of} ~ {ELICITATION} ~ {ACTOR} ~ {FURPS} ~ {OUTLINE} ~ {PROC} ~ {SPEED} ~ {PDF} & {SET}
    1 {REQUIREMENTS of} ~ {ELICITATION} ~ {ACTOR} ~ {FURPS} ~ {OUTLINE} ~ {PROC} ~ {SPEED} ~ {PDF} ~ {SET} & {UNNECESSARY}
    1 {REQUIREMENTS of} ~ {ELICITATION} ~ {ACTOR} ~ {FURPS} ~ {OUTLINE} ~ {PROC} ~ {SPEED} ~ {PDF} ~ {SET} ~ {UNNECESSARY} & {MISUSE}
    1 {INTERPRETATION} ~ {REQUIREMENTS}
    2 {DESIGN of} & {PERFORMANCE}
    2 {DESIGN of} ~ {REPRESENTATION} & {MAY} & {FOUNDATIO} & {OCTOBER}
    2 {DESIGN of} ~ {REPRESENTATION} & {MAY} & {FOUNDATIO} ~ {OCTOBER} & {PROCEDURAL}
    2 {DESIGN of} ~ {REPRESENTATION} & {MAY} & {FOUNDATIO} ~ {OCTOBER} ~ {PROCEDURAL} & {STRICT}
    2 {DESIGN of} ~ {REPRESENTATION} & {MAY} & {FOUNDATIO} ~ {OCTOBER} ~ {PROCEDURAL} ~ {STRICT} & {ENTER}
    2 {DESIGN of} ~ {REPRESENTATION} & {MAY} & {FOUNDATIO} ~ {OCTOBER} ~ {PROCEDURAL} ~ {STRICT} ~ {ENTER} & {NUMBER} & {LAYER}
    2 {DESIGN OF} ~ {REPRESENTATION} ~ {CAN}
    3 {PM} & {TEST} & {ATTRIBUTION}

    And this is the result of table with a ctxrule index:

    (only the column token_text shown)
    PM
    DESIGN
    DESIGN
    DESIGN
    DESIGN
    DESIGN
    DESIGN
    DESIGN
    REQUIREMENTS
    REQUIREMENTS
    REQUIREMENTS
    REQUIREMENTS
    REQUIREMENTS
    REQUIREMENTS
    REQUIREMENTS
    REQUIREMENTS
    REQUIREMENTS
    REQUIREMENTS
    INTERPRETATION

    so when I try to file a document with the word in there way, it should produce category 1 (based on rules), but since there is no word 'plan' in the tabel index, matches will return 0 means that the document is classifiedto not any category. I don't understand why this is happening. Everyone knows about it? I'd appreciate any help.
    Thank you very much.

    Share market means that the market immediately followed word on the part of the word, so if you don't have the word share then is not a match. If she had walked or hand, then he would be looking for just one part.

  • some doubts in the conversion of oracle query

    I have to convert the following query in ms access to oracle.

    INSERT INTO the Bill (Reffacture, InvoiceDesc)
    Select a_Invoices! [Ref provider] & "-" & Trim (a_Invoices! [invoice No.]) & "Q" & DatePart ("q", [invDate]) & "-" & DatePart("yyyy",[invDate]) & "SB" as Reffacture.
    Trim (a_Invoice_Desc! [Invoice line Description]) AS a Expr4
    Of a_Invoices a_Invoice_Desc INNER JOIN
    WE (a_Invoices. [Ref provider] is a_Invoice_Desc. [Ref provider])
    AND (a_Invoices. [Invoice No.] is a_Invoice_Desc. [Invoice No.)]
    WHERE (((a_Invoices. [<>ACK GL account]) »--- »)) ;

    for the quarter, I tried with select to_char (to_date ("PRVBTOT", "dd/mm/yy '"), 'Q') as quarterdate of "a_Invoices" - it worked, but how to combine all the

    Hello

    882431 wrote:
    Thanks for the input... I have another doubt based on the date

    I have a date stored in a field of type varchar, n'm copy in the date field

    For example: ' 18/4/2011 0:0:0.0' varchar field is, I tried with "' 2011/4/18 as yyyy/mm/dd ', I can add hh: mm: for the moment (I wasn't looking this), but there is one.0, can someone please tell me how shud convert it..." Sorry if asking a basic question, I already searched but to no avail.

    DATEs do not include fractions of a second. If you don't mind losing fractions of a second, you can simply remove them before pass the string to TO_DATE, like this

    TO_DATE ( REGEXP_REPLACE ( varchar2_column
                    , '\.[0-9]*$'
                    )
         , 'YYYY/MM/DD HH24:MI:SS'
         )
    

    REGEXP_REPLACE will remove the decimal point and any numbers after him. If the string does not contain a decimial, it is correct: REGEXP_REPLACE returns the immutable string in this case.

    If the fraction of a second is important, use a TIMESTAMP instead of a DATE column (and use the TO_TIMESTAMP instead of TO_DATE function).

  • Need to improve the performance of oracle query

    Hello
    Currently I wrote the request to get the maximun of XYZ company like this salary

    Select the salary of)
    Select the salary of the employee
    where the company = "XYZ".
    salary desc order)
    where rownum < 2;

    I thought to replace the same with the following query

    Select max (salary)
    the employee
    where the company = "XYZ";

    That one will be faster? can you provide some statistical data. It will be good if you share an oracle for this documentation.

    Thank you
    Khaldi

    Well, that's your requests, your data contained in your database, on your hardware... Anything that can have an impact. So who better to check if there is no difference in performance than yourself?

    Enable SQL tracing, run the statements, then analyze trace (with the help of tkprof or similar) files and look at the differences.

  • How to use a parameter query to select and display the data in the table of the façade

    Hiiiiii

    I am using Access 2007 database
    I want to select the specific data in the database using control of the chain as 'select product, size, weight of ProductInfo where barcode (chain control) =?'  and also display the same table of façade.

    I use the connected database toolkit.
    I saw the example of the parameterized insert, but it did not help to use parameterized select query, as well as to display data of parameterized select query.

    I looked for example on parameterized select query, but I don't have any.
    So pls guide me how to do this. I would like to know the other method (if any) that the use of parameter query to perform the same thing.
    If possble pls share a vi reference.
    Thank you!!!

    HII szewczak
    Thanks for the reply
    but I did not getsolution in one of your shared links
    My problem is solved. There is no need to use the parameter query to select control values
    In my case I want to display data from database where bar code is even entered by the user
    I use the data function DB TOOL CHOOSE and create the condition of chain based on concatenation of strings

  • The components of Oracle Forms and reports refers specifically to the which components?

    Hello

    Could you help me with the following question.

    Our client uses the following documents to improve reports and forms Oracle 11 g Release 1 on Oracle Forms and reports 11g Release 2.

    http://docs.Oracle.com/CD/E38115_01/doc.111210/e23975/upgrade_from_r1.htm#BDJFHIEH
    Oracle® Fusion Middleware Upgrade Guide for Oracle Forms and reports
    11g Release 2 (11.1.2.1)
    E23975-02 part number
    Upgrade-5,3 doing the Oracle Forms and reports 11 g Release 1 (11.1.1)
    ----------cut-----------
    Ensure that the destination Oracle instance and the destination Oracle WebLogic Server domain are running.

    To verify that the instance and domain are running, log on to Oracle Enterprise Manager Fusion Middleware control for the field and make sure that the managed servers and components Oracle Forms and reports are running.
    ----------cut-----------
    On the above documents, our client has a question.

    [Question]
    The components of Oracle Forms and reports refers specifically to the which components?
    (Or need to check what components are running?)

    Please give me some advice.

    Best regards

    David

    For Windows, you can use the command line or shortcuts in Windows that are created for you.  In the case of OPMN under Windows, a Windows Service is created.  Information on the power on/off is in the documentation of the product here:

    http://docs.Oracle.com/CD/E23943_01/Web.1111/e13708/TOC.htm

    http://docs.Oracle.com/CD/E23943_01/Web.1111/e13740/starting_nodemgr.htm

  • Generate a page based on a query variable in another page?

    Hello. I am trying to generate a page based on data from a single line in a table (not a report, such as the look of the page may be in a table). I've set up a report containing a list of all the lines where the first column consists of links; each link loads the new page and sends the value of the display of the link as a query variable.

    How to access the database without having to create a report? I think that PL/SQL and dynamic content is involved, but my knowledge in Application Express is Rusty at best.

    If you have a page parent with a report, you can create a column in the column link properties and link, you would choose an image and the elements on your page in which target you want to pass your values:

    1. report of the attributes / add column link (link on the right side)

    2. change your link column and go to the section "links in the column".

    3. choose the link image

    4. indicate your target page

    5 specify the (probably hidden) element on your page target to pass values to

    6 specify the column that contains the value of the key

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    -------------------------------------------------------------------

  • Facing the question Entity framework with Oracle 11 g using MVC 4 connecting

    Hello

    I am trying to connect to Oracle through Entity Framework data.

    I created two projects

    ((1) one for the project Web MVC4 access data) 2.

    It works fine if I am trying to connect using the console Application and App.config, but facing the question trying to connect using we.config and the web application.

    I added using Nuget packages in data access project.

    I made reference to this dll aaccess of data in the web project and try to call the oracle connection.

    Package.config:

    < Package >

    < package id = "EF" version = "6.0.2" targetFramework = "net45" / >

    < package id = "odp.net.x64" version = "112.3.20" targetFramework = "net45" / > "

    < package id = "Oracle.ManagedDataAccess" version = "12.1.021" targetFramework = "net45" / > "

    < package id = "Oracle.ManagedDataAccess.EntityFramework" version = "12.1.021" targetFramework = "net45" / > "

    < / packages >

    Web.Config:

    < configuration >

    < configSections >

    <!-for more information on the configuration of the Entity Framework, visit http://go.Microsoft.com/fwlink/?LinkId=237468 ->

    < section name = "EF".

    type = 'System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, Entity Framework, Version = 6.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089'

    requirePermission = "false" / >

    "< name =" article oracle.manageddataaccess.client"type =" OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version = 4.121.2.0, Culture = neutral, PublicKeyToken = 89b483f429c47342 "/ >

    < / configSections >

    < connectionStrings >

    < clear / >

    < name = "OracleDbContext" providerName = "Oracle.ManagedDataAccess.Client"

    connectionString ="Data Source = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = host address)(PORT=1521)) (CONNECT_DATA = (SERVICE_NAME = oracle))); User = username ID; Password = pwd; "/ >

    < / connectionStrings >

    < Entity Framework >

    <!-< defaultConnectionFactory type = "System.Data.Entity.Infrastructure.SqlConnectionFactory, Entity Framework" / >-->

    < defaultConnectionFactory type = "Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version = 4.121.2.0, Culture = neutral, PublicKeyToken = 89b483f429c47342" > "

    < / defaultConnectionFactory >

    <>providers

    < invariantName = "Oracle.ManagedDataAccess.Client provider"

    Type = "Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version = 6.121.2.0, Culture = neutral, PublicKeyToken = 89b483f429c47342" / >

    < invariantName = "System.Data.SqlClient provider" type = "System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" / > "

    < / providers >

    < / Entity Framework >

    < system.data >

    < DbProviderFactories >

    < remove invariant = "Oracle.ManagedDataAccess.Client" / > "

    "< add name =" ODP.NET, successful pilot"invariant =" Oracle.ManagedDataAccess.Client "description ="Oracle Data Provider for.NET, successful pilot"type =" Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version = 4.121.2.0, Culture = neutral, PublicKeyToken = 89b483f429c47342"/ >"

    < / DbProviderFactories >

    < system.data >

    < runtime >

    < assemblyBinding xmlns = "urn: schemas-microsoft-com: ASM.v1" >

    < dependentAssembly >

    < publisherPolicy apply = "no" / >

    < name = "Oracle.ManagedDataAccess assemblyIdentity" publicKeyToken = "89b483f429c47342" culture = "neutral" / > "

    < / dependentAssembly >

    < / assemblyBinding >

    < / SPAN >

    < oracle.manageddataaccess.client >

    < version number = "*" >

    < dataSources >

    < alias dataSource = "OracleDbContext" descriptor = "(DESCRIPTION = (ADDRESS = (PROTOCOL = tcp)(HOST=hostname) (PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME = oracle)));" User = username ID; Password = pwd; "/ >

    < / dataSources >

    < / version >

    < /oracle.manageddataaccess.client >

    < / configuration >

    I am facing the sub question:

    Provider of the type EF ' Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version = 6.121.2.0, Culture = neutral, PublicKeyToken = 89b483f429c47342 "in the application for the vendor configuration file ADO.NET with invariant name 'Oracle.ManagedDataAccess.Client' could not be loaded." Make sure that the qualified assembly name is used and that the assembly is available in the currently running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.

    Hello

    I tried with what follows and it started working.

    I just pointed out that line of defaultConnectionFactory in the web.config file

    Type = "Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version = 6.121.2.0, Culture = neutral, PublicKeyToken = 89b483f429c47342" / > "

    .

  • The use of bind variables in dynamic query created for Ref Cursor

    Hello

    I'm in a situation where there is a Ref cursor to which the query is built execution based on a loop. This is why the number of links would be known until the program runs.
    The application is currently using literals instead of bind variables.

    code snippet of the above is
    strSql: = "select * from emp where 1 = 1 and ().

    loop cursor1
    If cond is true then
    strSql = strSql | "ename = ' |" Cursor1.ColumnName;
    end loop;

    Open cursor2 for strSql;

    How to use links in the example above.

    sb92075 wrote:

    user13019948 wrote:
    Hello

    Here is the code I have my trying to change literal-based link to the base.

    What do you mean by "based bind?

    who, what, how determines the values to be 'bound '?

    He's referring to the coding style. He is currently using concatenated literal, and the goal is to change it to use the bindings.

    If I understand this it is known as method 4 dynamic SQL and requires DBMS_SQL. There are examples autour but they vary according to the type of statement being generated - SELECT statements require column lists to be parsed, unlike the INSERT/UPDATE/DELETE.

    This came up recently on my current project and I hit a demo. Here a table of names and values accepted procedure and had to build these in a single WHERE clause along the lines of

    AND t_names(i) = t_values(i)
    

    for an undetermined number of elements in the array. For this demonstration, I used a table that we called "attribute" (don't ask) which has columns including 'attribute_id' and 'name', and I need to build a query along the lines of

    select description from attribute where attribute_id = :b1 and name = :b2
    

    by the way '1012' and 'ISIN' respectively. (I use a table better and after a CREATE statement for her but I have to rush right now, sorry).

    declare
       k_sql_base        constant varchar2(500) := 'select description from attribute';
    
       t_names           constant varchar2_t := varchar2_t('attribute_id',  'name');
       t_values          constant varchar2_t := varchar2_t('1012',          'ISIN');
    
       l_sql             varchar2(500) := k_sql_base;
       l_rows_fetched    integer := 0;
       l_value           varchar2(4000);
    
       l_cursor_handle   integer;
    
    begin
       -- Construct the SQL statement with column names and bind variables e.g.
       -- 'select description from mars.attribute where attribute_id = :b1 and name = :b2'
       for i in t_names.first .. t_names.last loop
          l_sql := l_sql ||
             case i
                when t_names.first then ' where ' else ' and '
             end ||
             t_names(i) || ' = :b' || i;
       end loop;
    
       dbms_output.put_line('SQL statment = ' || l_sql); 
    
       -- Parse the statement we built above (the remaining steps require a parsed cursor):
       l_cursor_handle := dbms_sql.open_cursor;
       dbms_sql.parse(l_cursor_handle, l_sql, dbms_sql.native);
    
       -- Associate the 1st column of output with variable l_value - required for SELECT statements:
       -- (actually the 3rd param here 'column' seems to be only used to get a datatype, in this case we want a string -
       -- dbms_sql.column_value actually extracts the value into a specified variable, which can be different.
       -- All examples in the documentation pass a local variable without further comment, so not entirely clear what this does other than set the output datatype.)
       dbms_sql.define_column(l_cursor_handle, 1, l_value, 4000);
    
       -- Now go through values array binding actual values to :bn variables in the cursor (similar to USING clause of EXECUTE IMMEDIATE)
       for i in t_values.first .. t_values.last loop
          dbms_sql.bind_variable(l_cursor_handle, ':b'||i, t_values(i));
          dbms_output.put_line('Bound :b'||i || ' as ' || t_values(i));
       end loop;
    
       -- Open the cursor and fetch the result (no loop here because we are expecting a single-row result):
       l_rows_fetched := dbms_sql.execute_and_fetch(l_cursor_handle);
    
       -- 'Returns value of the cursor element for a given position in a cursor'
       -- Copy the value of column 1 to variable l_value (has to match
       -- dbms_sql.column_value(l_cursor_handle, 1, l_value);
       dbms_sql.column_value(l_cursor_handle, 1, l_value);
    
       dbms_output.put_line('Result = ''' || l_value || '''');
    
       dbms_sql.close_cursor(l_cursor_handle);
    end;
    

    Hope that helps...

  • Question about the use of constant variables in forms

    As I am still very new to forms, please forgive my ignorance, if the answer to my question is very simple. I'm trying to understand how to use constant variables in my application Forms. For example, if I want the return code of constants for the configuration application (not, mind these are examples):

    RC_SUCCESS CONSTANT PLS_INTEGER: = 1;
    RC_FAILURE CONSTANT PLS_INTEGER: = 0;
    RC_YEAR_DATA_NOT_FOUND: = 50;

    Then in a module I created, if I wanted to check the return code against one of the constants I would do:

    DECLARE
    RC PLS_INTEGER;
    BEGIN
    GET_YEAR_DATA ('2000 ', rc);
    IF rc = RC_YEAR_DATA_NOT_FOUND THEN
    -Make an error handling
    END IF;
    END;

    I know that you can declare constants within the individual procedures or packages, but I can't find information on how to do it in the world for the application. I read on the use of global variables in forms, but only the CHAR data type and the fact that the value can be modified doesn't really fit for this purpose have I missed something? Is there a config file or something for the Web server that can be used to configure these?

    Any help would be appreciated.

    Thank you

    To declare constants create a Package specification in a pll and deifne all your vitals, something like:

    PACKAGE PK_CONSTANTS IS
      RC_SUCCESS CONSTANT PLS_INTEGER := 1;
      RC_FAILURE CONSTANT PLS_INTEGER := 0;
      RC_YEAR_DATA_NOT_FOUND := 50;
    END;
    

    Then attach this pll for all your forms-modules and use it as

    IF rc = PK_CONSTANTS.RC_YEAR_DATA_NOT_FOUND THEN
      ..
    END IF;
    

    A word on exceptions or errors: to me more clear (and in the case of exceptions even better) to throw an exception only to hide behind return-codes.

Maybe you are looking for

  • Amendment N ° phone security

    How to change my phone no. pour receive my SMS security

  • Long pending with applecare?

    I'm just curious as to how long you guys have been waiting? For me its 2 hours and counting!  Just curious, if someone has beat me? Lets see, I bought applecare for my iphone, thank God, I keep received.  I never needed to use it for the first years,

  • Satellite A100-998 PAAS: Uninstallation of Vista

    I just brought a PAAS Toshiba A100-998 with support xp (Vista capable). I broughtVista (32-bit) upgrading at the time, but am debating whether to install ornot. If I do install and have problems I can uninstall it later? Is the Xp OS and the function

  • NOR-DAQmx 8.9 and 9.0.2 simultaneous install?

    I have the 2009 and 7.1 on the same machine.  When I install DAQmx 9.0.2 for 2009, all my vi acquisition for 7.1 (installed with NOR-DAQmx 8.9) will miss.  Is there a way for 7.1, 2009 and DAQmx 8.9 and 9.0.2 all to coexist on a machine?  Currently,

  • Cannot access my account and I am the administrator of the system. The user profile cannot be loaded

    I can't log into my account. I am the administrator of the system account, but he said: "the service user profile Service has no log on." User profile cannot be loaded. Any suggestions? I can connect to other accounts, but they are not administrative