Như APC đã nói, không có chức năng tích hợp để thực hiện việc này. Nhưng bạn có thể sử dụng WolframAlpha API từ PL/SQL:
declare
v_equation varchar2(32767) :=
'(3.5/(1+x))+(3.5/(1+x)^2)+(3.5/(1+x)^3)+(3.5/(1+x)^4)+(100/(1+x)^4)=101.55';
v_escaped_url varchar2(32767);
v_uri httpuritype;
v_xml xmltype;
v_count number := 1;
begin
--Escape the URL.
--I used chr(38) for ampersand, in case your IDE think it's a substitution variable
v_escaped_url :=
'http://api.wolframalpha.com/v2/query?appid=EQGHLV-UYUEYY9ARU'||chr(38)||'input='
||utl_url.escape(v_equation, escape_reserved_chars => true)
||chr(38)||'format=plaintext';
--Create an HTTPURIType, and get the XML
v_uri := httpuritype.createUri(v_escaped_url);
v_xml := v_uri.getXML;
--Complex solutions
while v_xml.existsNode('/queryresult/pod[@title="Complex solutions"]/subpod['||v_count||']') = 1 loop
dbms_output.put_line(v_xml.extract('/queryresult/pod[@title="Complex solutions"]/subpod['||v_count||']/plaintext/text()').getStringVal());
v_count := v_count + 1;
end loop;
--Real solutions
v_count := 1;
while v_xml.existsNode('/queryresult/pod[@title="Real solutions"]/subpod['||v_count||']') = 1 loop
dbms_output.put_line(v_xml.extract('/queryresult/pod[@title="Real solutions"]/subpod['||v_count||']/plaintext/text()').getStringVal());
v_count := v_count + 1;
end loop;
end;
/
Kết quả:
x = -1.00006-0.996229 i
x = -1.00006+0.996229 i
x = -1.99623
x = 0.0308219
Có rất nhiều nhược điểm tiềm năng để tiếp cận này. Nó sẽ rất chậm và API không miễn phí. Ví dụ của tôi hoạt động vì tôi đã sử dụng appid nhà phát triển miễn phí của mình, nhưng nó chỉ tốt cho một số lượng nhỏ các cuộc gọi.
Nguồn
2013-02-09 05:37:26
Tôi đoán, vì bạn đang sử dụng SQL, cơ sở dữ liệu sẽ cung cấp giá trị cho 'x', đúng không? –
Không, thực sự tôi muốn tìm hiểu giá trị của x xD –
nếu nó không phải là một chức năng được xây dựng trong, bạn hoặc là sử dụng sức mạnh vũ phu hoặc viết một số chức năng tùy chỉnh. Tùy thuộc vào những gì bạn muốn làm, tôi sẽ xem xét sử dụng Mathematica (http://www.wolfram.com/mathematica) – tbone